ifacethoughts

wp_filter

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 [...]

Say your thought!

Who are you?

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.

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.