Last active
December 2, 2015 11:53
-
-
Save JodiWarren/01065d36f0ac38c56c7f to your computer and use it in GitHub Desktop.
Use this snippet to move all hooked actions from one hook to another. Very useful for moving hooked items to the footer. Use carefully.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| global $wp_filter; | |
| $hook_to_check = 'nameOfHook'; | |
| $destination_hook = 'wp_footer'; | |
| $acf_front_end_scripts = $wp_filter[$hook_to_check]; | |
| foreach ( $acf_front_end_scripts as $scripts ) { | |
| foreach ( $scripts as $script ) { | |
| remove_action( $hook_to_check, $script['function'] ); | |
| add_action( $destination_hook, $script['function'], $script['accepted_args'] ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment