Articles of hooks

Generate dormant hook references

It seems a lot of plugin developers take the time to add filter/action hooks to let users tweak their products’ functionality. Which is great, but what they often don’t do is provide a list of hooks and how many arguments they take. Has anyone found the best automated way to point at a plugin (or […]

Hierarchical taxonomy UI

I don’t like the way the taxonomies are displayed within the WordPress admin and was wondering if anyone knew the best way to hook in and change it. Currently if I select some terms within my post those selected terms go to the top of the list and the hierarchy is broken making it visually […]

How can I see all the actions attached to an “add_action” hook?

I’m working with the admin bar and trying to debug some of the menus and their priorities. I know several callbacks get bound to actions, such as this one: add_action( ‘admin_bar_menu’, ‘wp_admin_bar_wp_menu’, 10 ); How can I see what is lined up to be called when a hook like admin_bar_menu is called?

Difference between do_action and add_action

This question might be wrong, I am not sure about it. Because I am not clear on this. I know add_action it is used to to hook our function to the specified function. For example add_action(‘wp_head’.’myfunc’); now what ever code in myfunc will be executed in the wp_head(). This is clear but i am having […]

Are there any hooks that alter the 404 logic?

Provided you have a 404 page defined in your theme, WordPress will display a 404 page if “tag” is defined in $wp_query->query_vars, and there are no posts matching that tag. I’m writing a plugin that displays some information on each page, in addition to posts. I’d like to alter the 404 logic so that the […]

how to limit search to post titles?

Is there a way to limit search to post titles? I know I can modify query.php core file but there must be a way to do it with hooks right? Thanks in advance!

Is there a hook that runs after a user logs in?

I am writing a plugin that fetches some extended user info from a remote service and I need it to execute its function each time a user logs in. Is there a hook that gets fired after login that I can add an action to?

How to add Custom Blog Options to new blog setup form?

Seems like a simple enough requirement, but I’m struggling: I want to add an option field to the “Add New Site”. A simple text option is fine. How do I do this? I need to save this custom blog option when the site is created. I know I can use the ‘wpmu_new_blog’ hook, which passes […]

Passing a parameter to filter and action functions

Is a way to pass my own parameters to the function in add_filter or add_action. For example take a look in the following code: function my_content($content, $my_param) { do something… using $my_param here … return $content; } add_filter(‘the_content’, ‘my_content’, 10, 1); Can I pass my own parameter? something like: add_filter(‘the_content’, ‘my_content($my_param)’, 10, 1) or add_filter(‘the_content’, […]

How to hook update_post_meta and delete_post_meta?

I’m still struggling to get my head around this whole hooking into things, so I’m really stuck on trying to do the following task: If update_post_meta is fired then check to see if the meta_key is equal to something (I want to trigger some code if a particular meta_key is used). If the meta key […]