Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class FilterableScripts extends WP_Scripts
- {
- function localize( $handle, $object_name, $l10n )
- {
- $l10n = apply_filters( 'script_l10n', $handle, $object_name, $l10n );
- return parent::localize($handle, $object_name, $l10n);
- }
- }
- public function phyt_filter_script_intlization() {
- //These exist here:
- var_dump($GLOBALS['wp_scripts']->registered['acf-field-group']);
- var_dump($GLOBALS['wp_scripts']->registered['acf-input']);
- $GLOBALS['wp_scripts'] = new PhytJobsFilterableScripts;
- // But now they are gone
- print_r(isset($GLOBALS['wp_scripts']->registered['acf-field-group']));
- }
- public function phyt_filter_script_intlization() {
- // store the arrays
- $acf_field_group = $GLOBALS['wp_scripts']->registered['acf-field-group'];
- $acf_input = $GLOBALS['wp_scripts']->registered['acf-input'];
- $GLOBALS['wp_scripts'] = new PhytJobsFilterableScripts;
- // re-insert the arrays
- $GLOBALS['wp_scripts']->registered['acf-field-group'] = $acf_field_group;
- $GLOBALS['wp_scripts']->registered['acf-input'] = $acf_input;
- }
Add Comment
Please, Sign In to add comment