WordPress provides a facility of hooks. They can be used by plugin and theme developers can modify custom behavior at different points in WordPress. Mark Jaquith has compiled a directory of hooks provided by WordPress.

Actions and filters are two different types of hooks, they are semnatically different but syntactically the same. These filters and actions are stored in the wp_filter global variable. It is set using add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) function defined in [wordpress root folder]/wp-includes/functions.php.

WordPress adds certain default actions and filters, most of which are done in [wordpress root folder]/wp-includes/default-filters.php. Function do_action($tag, $arg = ”) is used internally by WordPress to invoke the different registered filters and actions.

Plugin and theme developers can define custom functions and add them as filters or actions using the following functions provided by WordPress:

  • add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1): to register filters
  • add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1): to register actions
  • remove_filter($tag, $function_to_remove, $priority = 10, $accepted_args = 1): to remove filters
  • remove_action($tag, $function_to_remove, $priority = 10, $accepted_args = 1): to remove actions

Back to full list of global variables.

Technorati tags: , , , , , , , ,

Discussion [Participate or Link]

  1. Abhijit Nadgouda @ iface » Blog Archive » Wordpress Global Variables said:

    […] $wp_filter […]

  2. references» Blog Archive » Wordpress Global Variables said:

    […] $wp_filter […]

  3. Sagive SEO said:

    Hey, thanks for posting.. think there is a way to trace the origin of the hook?

    i can list them no problem by entering $wp_filter into an array but i dont know the meaning of some returend value such as:

    That kidna crafty.. no?

    also i would love to be able to find it becose.. well basicly i am lazy and dont want to go plugin by plugin..

    (p.s: why dont you add a “register for comments”? makes like easier..)

  4. Abhijit Nadgouda’s List of WordPress Global Variables « Lorelle on WordPress said:

    […] Variables: wp_filter, richedit, page_cache, pagenow, wp_version, table_prefix,wp,admin_page_hooks, wp_object_cache, […]

Say your thought!

If you want to use HTML you can use these tags: <a>, <em>, <strong>, <abbr>, <code>, <blockquote>. Closing the tags will be appreciated as this site uses valid XHTML.



Abhijit Nadgouda
iface Consulting
+91 9819820312
My bookmarks


This is the weblog of Abhijit Nadgouda where he writes down his thoughts on software development and related topics. You are invited to subscribe to the feed to stay updated or check out more subscription options. Or you can choose to browse by one of the topics.