Last active
January 21, 2025 09:47
-
-
Save damiencarbery/cbd402dbb469728e95306f239ff505e5 to your computer and use it in GitHub Desktop.
Use $wp_filter global to view functions attached to actions and filters
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 | |
/* | |
Plugin Name: wp_filter functions | |
Plugin URI: http://www.damiencarbery.com/2017/06/list-functions-attached-to-an-action/ | |
Description: List functions attached to all actions and filters. DON'T DO IT! | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
add_action( 'wp_head', 'wp_filter_the_wrong_way' ); | |
function wp_filter_the_wrong_way() { | |
global $wp_filter; | |
// Do NOT do this - it will render many MB of content. | |
echo '<!-- ', var_export( $wp_filter, true ), ' -->'; | |
} |
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 | |
/* | |
Plugin Name: genesis_entry_content functions | |
Plugin URI: http://www.damiencarbery.com/2017/06/list-functions-attached-to-an-action/ | |
Description: List functions attached to genesis_entry_content. | |
Author: Damien Carbery | |
Version: 0.1 | |
*/ | |
add_action( 'wp_head', 'wp_filter_for_one_action' ); | |
function wp_filter_for_one_action() { | |
global $wp_filter; | |
echo '<!-- ', var_export( $wp_filter[ 'genesis_entry_content' ], true ), ' -->'; | |
} |
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
<!-- WP_Hook::__set_state(array( | |
'callbacks' => | |
array ( | |
8 => | |
array ( | |
'genesis_do_post_image' => | |
array ( | |
'function' => 'genesis_do_post_image', | |
'accepted_args' => 1, | |
), | |
), | |
10 => | |
array ( | |
'genesis_do_post_content' => | |
array ( | |
'function' => 'genesis_do_post_content', | |
'accepted_args' => 1, | |
), | |
), | |
12 => | |
array ( | |
'genesis_do_post_content_nav' => | |
array ( | |
'function' => 'genesis_do_post_content_nav', | |
'accepted_args' => 1, | |
), | |
), | |
14 => | |
array ( | |
'genesis_do_post_permalink' => | |
array ( | |
'function' => 'genesis_do_post_permalink', | |
'accepted_args' => 1, | |
), | |
), | |
20 => | |
array ( | |
'bch_add_store_custom_field_info' => | |
array ( | |
'function' => 'bch_add_store_custom_field_info', | |
'accepted_args' => 1, | |
), | |
), | |
), | |
'iterations' => | |
array ( | |
), | |
'current_priority' => | |
array ( | |
), | |
'nesting_level' => 0, | |
'doing_action' => false, | |
)) --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment