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
190  * @global array $wp_filter         Stores all of the filters.
191  * @global array $merged_filters    Merges the filter hooks using this function.
192  * @global array $wp_current_filter Stores the list of current filters with the current one last.
193  *
194  * @param string $tag   The name of the filter hook.
195  * @param mixed  $value The value on which the filters hooked to `$tag` are applied on.
196  * @param mixed  $var   Additional variables passed to the functions hooked to `$tag`.
197  * @return mixed The filtered value after all hooked functions are applied to it.
198  */
199 function apply_filters( $tag, $value ) {
200      global $wp_filter, $merged_filters, $wp_current_filter;
201
202      $args = array();
203
204      // Do 'all' actions first.
205      if ( isset($wp_filter['all']) ) {
206           $wp_current_filter[] = $tag;
207           $args = func_get_args();
208           _wp_call_all_hook($args);
 
Line Code
252  *
253  * @global array $wp_filter         Stores all of the filters
254  * @global array $merged_filters    Merges the filter hooks using this function.
255  * @global array $wp_current_filter Stores the list of current filters with the current one last
256  *
257  * @param string $tag  The name of the filter hook.
258  * @param array  $args The arguments supplied to the functions hooked to $tag.
259  * @return mixed The filtered value after all hooked functions are applied to it.
260  */
261 function apply_filters_ref_array($tag, $args) {
262      global $wp_filter, $merged_filters, $wp_current_filter;
263
264      // Do 'all' actions first
265      if ( isset($wp_filter['all']) ) {
266           $wp_current_filter[] = $tag;
267           $all_args = func_get_args();
268           _wp_call_all_hook($all_args);
269      }
270
 
Line Code
473  * @global array $wp_filter         Stores all of the filters
474  * @global array $wp_actions        Increments the amount of times action was triggered.
475  * @global array $merged_filters    Merges the filter hooks using this function.
476  * @global array $wp_current_filter Stores the list of current filters with the current one last
477  *
478  * @param string $tag The name of the action to be executed.
479  * @param mixed  $arg Optional. Additional arguments which are passed on to the
480  *                    functions hooked to the action. Default empty.
481  */
482 function do_action($tag, $arg = '') {
483      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
484
485      if ( ! isset($wp_actions[$tag]) )
486           $wp_actions[$tag] = 1;
487      else
488           ++$wp_actions[$tag];
489
490      // Do 'all' actions first
491      if ( isset($wp_filter['all']) ) {
 
Line Code
557  *                  functions hooked to $tag< are supplied using an array.
558  * @global array $wp_filter         Stores all of the filters
559  * @global array $wp_actions        Increments the amount of times action was triggered.
560  * @global array $merged_filters    Merges the filter hooks using this function.
561  * @global array $wp_current_filter Stores the list of current filters with the current one last
562  *
563  * @param string $tag  The name of the action to be executed.
564  * @param array  $args The arguments supplied to the functions hooked to `$tag`.
565  */
566 function do_action_ref_array($tag, $args) {
567      global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
568
569      if ( ! isset($wp_actions[$tag]) )
570           $wp_actions[$tag] = 1;
571      else
572           ++$wp_actions[$tag];
573
574      // Do 'all' actions first
575      if ( isset($wp_filter['all']) ) {