Guest User

Untitled

a guest
Jan 20th, 2018
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. class FilterableScripts extends WP_Scripts
  2. {
  3. function localize( $handle, $object_name, $l10n )
  4. {
  5. $l10n = apply_filters( 'script_l10n', $handle, $object_name, $l10n );
  6. return parent::localize($handle, $object_name, $l10n);
  7. }
  8.  
  9. }
  10.  
  11. public function phyt_filter_script_intlization() {
  12. //These exist here:
  13. var_dump($GLOBALS['wp_scripts']->registered['acf-field-group']);
  14. var_dump($GLOBALS['wp_scripts']->registered['acf-input']);
  15. $GLOBALS['wp_scripts'] = new PhytJobsFilterableScripts;
  16. // But now they are gone
  17. print_r(isset($GLOBALS['wp_scripts']->registered['acf-field-group']));
  18. }
  19.  
  20. public function phyt_filter_script_intlization() {
  21. // store the arrays
  22. $acf_field_group = $GLOBALS['wp_scripts']->registered['acf-field-group'];
  23. $acf_input = $GLOBALS['wp_scripts']->registered['acf-input'];
  24. $GLOBALS['wp_scripts'] = new PhytJobsFilterableScripts;
  25. // re-insert the arrays
  26. $GLOBALS['wp_scripts']->registered['acf-field-group'] = $acf_field_group;
  27. $GLOBALS['wp_scripts']->registered['acf-input'] = $acf_input;
  28. }
Add Comment
Please, Sign In to add comment