When to use actions and when to use filters

+1 to both of the other answers, for explaining the primary differences between actions and filters. However, to answer your specific question, about which to use for modifying a query: Injecting your custom query into the template does, as you guessed, require hooking into an existing action. (Whether or not wp_footer is the correct/ideal action … Read more

Admin Hook at the Login Page

If you don’t care about the actual action you can use login_init action like this: add_action( ‘login_init’, ‘wpse8170_login_init’ ); function wpse8170_login_init() { // do your stuff here } But if you want to handle only special actions, then you need to hook into login_form_{action} action, like this: add_action( ‘login_form_login’, ‘wpse8170_login_form_login’ ); function wpse8170_login_form_login() { // … Read more

WooCommerce – Overwrite action hook [closed]

It’s actually pretty simple to change the title in content-product.php, but you won’t be able to do it with a hook. Near the top of the file, you should see this line: Override this template by copying it to yourtheme/woocommerce/content-product.php All you have to do is copy the file to the above directory, replacing “yourtheme” … Read more

Disable HTML (Text) Tab in Post Editor

I was hunting for a way to do this, and no-one seems to mention the wp_editor_settings filter. This worked for me: function my_editor_settings($settings) { $settings[‘quicktags’] = false; return $settings; } add_filter(‘wp_editor_settings’, ‘my_editor_settings’);

Hooks for Links Box [duplicate]

Right now there are no hooks to do that from a plugin and the function that makes the search query itself is not pluggable which means that the only way to achieve that is to hack core files. Currently there is an open Trac Ticket asking for some kind of hook.