Too many actions/filters!
Take a look at Mike’s answer to a similar question more specifically the plugin he posted there can be used to create a list of all action hooks and filters that were called to generate that page in order of execution.
Take a look at Mike’s answer to a similar question more specifically the plugin he posted there can be used to create a list of all action hooks and filters that were called to generate that page in order of execution.
It’s not possible to remove it with remove_action() the way you’ve written it. When you hooked it here: add_action( ‘woocommerce_shop_loop_item_title’, array( $this, ‘change_title’ ), 10 ); The $this means that the function that’s hooked is on this specific instance of My_class. When using remove_action() you need to pass the same instance of the class: remove_action( … Read more
The way to pass by reference to a WP action is with: do_action_ref_array(‘action_hook’, array(&$data) );
Where are you calling add_action()? If it’s in a place where you’re already outputting HTML, it’s too late, and that’s probably a place that wont even be looked at during an AJAX request. You should include that code in your theme’s functions.php file, or as early as possible in a plugin.
you can use pre_post_update action hook like so: add_action(‘pre_post_update’,’post_updating_callback’); function post_updating_callback($post_id){ global $post; // verify if this is an auto save routine. // If it is our form has not been submitted, so we dont want to do anything if ( defined( ‘DOING_AUTOSAVE’ ) && DOING_AUTOSAVE ) return; if ($post->post_status == “publish”){ //do update stuff … Read more
Get sidebar is a really thin wrapper around locate_template, which just searches the current child theme and parent theme directory for the given sidebar. get_sidebar in wp-includes/general-template.php: $templates = array(); if ( isset($name) ) $templates[] = “sidebar-{$name}.php”; $templates[] = ‘sidebar.php’; // Backward compat code will be removed in a future release if (” == locate_template($templates, … Read more
Remember Apple’s “Goto Fail”? Similar situation: Your code actually does this, when indentation is corrected: foreach ( $post_types as $post_type ) remove_meta_box(‘trackbacksdiv’, $post_type, ‘normal’); remove_meta_box(‘postcustom’, $post_type, ‘normal’); remove_meta_box(‘authordiv’, $post_type, ‘normal’); remove_meta_box(‘postexcerpt’, $post_type, ‘normal’); So, it should does the job for trackbacksdiv, but not for the rest because the function calls are outside of the foreach … Read more
For this example lets say we have the following do_action(‘bt_custom_action’, get_the_ID(), get_the_title(), get_the_content()); The arguments that will be passed to add_action would be in this order the post id the post title the post content By default if we hook into our do_action without any arguments, like this add_action(‘bt_custom_action’, ‘bt_callback_func’); Our call back function “gets” … Read more
Starting with version 3.6 WordPress actively discourages from deregistering “critical” scripts in admin at all. For posed scope (loading newer jQuery in specific part of admin) it would make more sense to load custom copy of jQuery normally and use noConflict() on it right away to isolate it in own variable to be used in … Read more
Searching Codex or Google you can find some lists of WordPress hooks, but believe me, them are not useful if you don’t know where, when and how they are triggered. While coding for WordPress, the question “Which hook should I use?” is very common and frequent, but believe me, a list of all WordPress hooks, … Read more