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      $wp_current_filter[] = $tag;
139
140      // Do 'all' actions first
141      if ( isset($wp_filter['all']) ) {
142           $args = func_get_args();
143           _wp_call_all_hook($args);
 
Line Code
184  * @since 3.0.0
185  * @global array $wp_filter Stores all of the filters
186  * @global array $merged_filters Merges the filter hooks using this function.
187  * @global array $wp_current_filter stores the list of current filters with the current one last
188  *
189  * @param string $tag The name of the filter hook.
190  * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
191  * @return mixed The filtered value after all hooked functions are applied to it.
192  */
193 function apply_filters_ref_array($tag, $args) {
194      global $wp_filter, $merged_filters, $wp_current_filter;
195
196      $wp_current_filter[] = $tag;
197
198      // Do 'all' actions first
199      if ( isset($wp_filter['all']) ) {
200           $all_args = func_get_args();
201           _wp_call_all_hook($all_args);
202      }
 
Line Code
343  * @subpackage Plugin
344  * @since 1.2
345  * @global array $wp_filter Stores all of the filters
346  * @global array $wp_actions Increments the amount of times action was triggered.
347  *
348  * @param string $tag The name of the action to be executed.
349  * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action.
350  * @return null Will return null if $tag does not exist in $wp_filter array
351  */
352 function do_action($tag, $arg = '') {
353      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
354
355      if ( ! isset($wp_actions) )
356           $wp_actions = array();
357
358      if ( ! isset($wp_actions[$tag]) )
359           $wp_actions[$tag] = 1;
360      else
361           ++$wp_actions[$tag];
 
Line Code
429  * @subpackage Plugin
430  * @since 2.1
431  * @global array $wp_filter Stores all of the filters
432  * @global array $wp_actions Increments the amount of times action was triggered.
433  *
434  * @param string $tag The name of the action to be executed.
435  * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt>
436  * @return null Will return null if $tag does not exist in $wp_filter array
437  */
438 function do_action_ref_array($tag, $args) {
439      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
440
441      if ( ! isset($wp_actions) )
442           $wp_actions = array();
443
444      if ( ! isset($wp_actions[$tag]) )
445           $wp_actions[$tag] = 1;
446      else
447           ++$wp_actions[$tag];