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
168  * @global array $wp_filter         Stores all of the filters.
169  * @global array $merged_filters    Merges the filter hooks using this function.
170  * @global array $wp_current_filter Stores the list of current filters with the current one last.
171  *
172  * @param string $tag   The name of the filter hook.
173  * @param mixed  $value The value on which the filters hooked to `$tag` are applied on.
174  * @param mixed  $var   Additional variables passed to the functions hooked to `$tag`.
175  * @return mixed The filtered value after all hooked functions are applied to it.
176  */
177 function apply_filters( $tag, $value ) {
178      global $wp_filter, $merged_filters, $wp_current_filter;
179
180      $args = array();
181
182      // Do 'all' actions first.
183      if ( isset($wp_filter['all']) ) {
184           $wp_current_filter[] = $tag;
185           $args = func_get_args();
186           _wp_call_all_hook($args);
 
Line Code
230  *
231  * @global array $wp_filter         Stores all of the filters
232  * @global array $merged_filters    Merges the filter hooks using this function.
233  * @global array $wp_current_filter Stores the list of current filters with the current one last
234  *
235  * @param string $tag  The name of the filter hook.
236  * @param array  $args The arguments supplied to the functions hooked to $tag.
237  * @return mixed The filtered value after all hooked functions are applied to it.
238  */
239 function apply_filters_ref_array($tag, $args) {
240      global $wp_filter, $merged_filters, $wp_current_filter;
241
242      // Do 'all' actions first
243      if ( isset($wp_filter['all']) ) {
244           $wp_current_filter[] = $tag;
245           $all_args = func_get_args();
246           _wp_call_all_hook($all_args);
247      }
248
 
Line Code
451  * @global array $wp_filter         Stores all of the filters
452  * @global array $wp_actions        Increments the amount of times action was triggered.
453  * @global array $merged_filters    Merges the filter hooks using this function.
454  * @global array $wp_current_filter Stores the list of current filters with the current one last
455  *
456  * @param string $tag The name of the action to be executed.
457  * @param mixed  $arg Optional. Additional arguments which are passed on to the
458  *                    functions hooked to the action. Default empty.
459  */
460 function do_action($tag, $arg = '') {
461      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
462
463      if ( ! isset($wp_actions[$tag]) )
464           $wp_actions[$tag] = 1;
465      else
466           ++$wp_actions[$tag];
467
468      // Do 'all' actions first
469      if ( isset($wp_filter['all']) ) {
 
Line Code
535  *                  functions hooked to $tag< are supplied using an array.
536  * @global array $wp_filter         Stores all of the filters
537  * @global array $wp_actions        Increments the amount of times action was triggered.
538  * @global array $merged_filters    Merges the filter hooks using this function.
539  * @global array $wp_current_filter Stores the list of current filters with the current one last
540  *
541  * @param string $tag  The name of the action to be executed.
542  * @param array  $args The arguments supplied to the functions hooked to `$tag`.
543  */
544 function do_action_ref_array($tag, $args) {
545      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
546
547      if ( ! isset($wp_actions[$tag]) )
548           $wp_actions[$tag] = 1;
549      else
550           ++$wp_actions[$tag];
551
552      // Do 'all' actions first
553      if ( isset($wp_filter['all']) ) {