Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: {$tag}

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

This hook occurs 4 times in this file.

Line Code
125  * @global array $wp_filter Stores all of the filters
126  * @global array $merged_filters Merges the filter hooks using this function.
127  * @global array $wp_current_filter stores the list of current filters with the current one last
128  *
129  * @param string $tag The name of the filter hook.
130  * @param mixed $value The value on which the filters hooked to <tt>$tag</tt> are applied on.
131  * @param mixed $var,... Additional variables passed to the functions hooked to <tt>$tag</tt>.
132  * @return mixed The filtered value after all hooked functions are applied to it.
133  */
134 function apply_filters($tag, $value) {
135      global $wp_filter, $merged_filters, $wp_current_filter;
136
137      $args = array();
138
139      // Do 'all' actions first
140      if ( isset($wp_filter['all']) ) {
141           $wp_current_filter[] = $tag;
142           $args = func_get_args();
143           _wp_call_all_hook($args);
 
Line Code
188  * @since 3.0.0
189  * @global array $wp_filter Stores all of the filters
190  * @global array $merged_filters Merges the filter hooks using this function.
191  * @global array $wp_current_filter stores the list of current filters with the current one last
192  *
193  * @param string $tag The name of the filter hook.
194  * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
195  * @return mixed The filtered value after all hooked functions are applied to it.
196  */
197 function apply_filters_ref_array($tag, $args) {
198      global $wp_filter, $merged_filters, $wp_current_filter;
199
200      // Do 'all' actions first
201      if ( isset($wp_filter['all']) ) {
202           $wp_current_filter[] = $tag;
203           $all_args = func_get_args();
204           _wp_call_all_hook($all_args);
205      }
206
 
Line Code
350  * @subpackage Plugin
351  * @since 1.2
352  * @global array $wp_filter Stores all of the filters
353  * @global array $wp_actions Increments the amount of times action was triggered.
354  *
355  * @param string $tag The name of the action to be executed.
356  * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action.
357  * @return null Will return null if $tag does not exist in $wp_filter array
358  */
359 function do_action($tag, $arg = '') {
360      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
361
362      if ( ! isset($wp_actions) )
363           $wp_actions = array();
364
365      if ( ! isset($wp_actions[$tag]) )
366           $wp_actions[$tag] = 1;
367      else
368           ++$wp_actions[$tag];
 
Line Code
439  * @subpackage Plugin
440  * @since 2.1
441  * @global array $wp_filter Stores all of the filters
442  * @global array $wp_actions Increments the amount of times action was triggered.
443  *
444  * @param string $tag The name of the action to be executed.
445  * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
446  * @return null Will return null if $tag does not exist in $wp_filter array
447  */
448 function do_action_ref_array($tag, $args) {
449      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
450
451      if ( ! isset($wp_actions) )
452           $wp_actions = array();
453
454      if ( ! isset($wp_actions[$tag]) )
455           $wp_actions[$tag] = 1;
456      else
457           ++$wp_actions[$tag];