edit_{$taxonomy} | Hook

You are getting old version of the term, because edit_{$taxonomy} action is fired after the term is updated but before term’s cache is cleared. Use edited_{$taxonomy} hook, which fires your action after the term is updated and its cache is cleared.

Are there hooks for WordPress updates?

Yes, there is a hook you can use, it’s called upgrader_process_complete. This hook fires after plugins or core has been upgraded. You can hook to this action and send an email: function send_custom_email( $object, $options ) { // Get the path for plugins $plugin_path = plugin_basename( __FILE__ ); // Check if the plugin is upgraded … Read more

Can not set custom title on some WordPress setups

This is most likely due to difference in your theme’s support. Some themes render the title by using the wp_title filter, some by using pre_get_document_title. If your theme has this line in its functions.php file: add_theme_support(‘title-tag’); Then you need to use the pre_get_document_title filter, as follows: add_filter(‘pre_get_document_title’, ‘my_title’); function my_title() { return ‘Some title’; } … Read more

How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme

You can use the global $wp_scripts and global $wp_styles; to get all registerd scripts and styles. Eg. All Scripts // All Scripts global $wp_scripts; $all_scripts = array(); foreach( $wp_scripts->registered as $script ) : $all_scripts[$script->handle] = $script->src; endforeach; // echo ‘<pre>’; // print_r( $all_scripts ); // echo ‘</pre>’; All Styles // All Styles global $wp_styles; $all_styles … Read more

Deactivate Plugin on Theme Switch

I haven’t tested this, so it might not work correctly, but the essence of what you’re trying to do is hook into the after_switch_theme hook and see if the $old_name is DahTheme. If it is, that means that the current theme isn’t DahTheme, so you want to deactivate the plugin. function wpse_after_switch_theme( $old_name, $old_theme ) … Read more

How to debug user_register hook

Rafael, (as requested, turning comments into answer) ‘user_register’ fires when a user registers, not when a user is edited or updated. Try something like https://codex.wordpress.org/edit_user_profile_update Wrt output in hooks. It depends when/how the hook is being executed. The user profile ones are tricky because wp does stuff to prevent a double submission. One could use … Read more

How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?

If you know the existing callback and priority you can just remove the filters and then add again at a different priority: remove_filter( ‘the_content’, ‘convert_smilies’, 20 ); add_filter( ‘the_content’, ‘convert_smilies’, 30 ); remove_filter( ‘the_content’, ‘capital_P_dangit’, 11 ); add_filter( ‘the_content’, ‘capital_P_dangit’, 20 );

Featured Image Action Hook

If you wanna catch the event before saving the post, you won’t be able to do this with PHP – setting the featured image is done with JavaScript (there is a hidden field and it’s value is populated with JS when user picks a thumbnail from Media Uploader. Also the thumb preview is rendered with … Read more