WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )
apply_filters( "hook_name", "what_to_filter" )
.Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 4 times in this file.
Line | Code |
---|---|
147 | * @global array $wp_current_filter stores the list of current filters with the current one last |
148 | * |
149 | * @since 0.71 |
150 | * |
151 | * @param string $tag The name of the filter hook. |
152 | * @param mixed $value The value on which the filters hooked to <tt>$tag</tt> are applied on. |
153 | * @param mixed $var Additional variables passed to the functions hooked to <tt>$tag</tt>. |
154 | * @return mixed The filtered value after all hooked functions are applied to it. |
155 | */ |
156 | function apply_filters( $tag, $value ) { |
157 | global $wp_filter, $merged_filters, $wp_current_filter; |
158 |
|
159 | $args = array(); |
160 |
|
161 | // Do 'all' actions first |
162 | if ( isset($wp_filter['all']) ) { |
163 | $wp_current_filter[] = $tag; |
164 | $args = func_get_args(); |
165 | _wp_call_all_hook($args); |
Line | Code |
208 | * @since 3.0.0 |
209 | * @global array $wp_filter Stores all of the filters |
210 | * @global array $merged_filters Merges the filter hooks using this function. |
211 | * @global array $wp_current_filter stores the list of current filters with the current one last |
212 | * |
213 | * @param string $tag The name of the filter hook. |
214 | * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt> |
215 | * @return mixed The filtered value after all hooked functions are applied to it. |
216 | */ |
217 | function apply_filters_ref_array($tag, $args) { |
218 | global $wp_filter, $merged_filters, $wp_current_filter; |
219 |
|
220 | // Do 'all' actions first |
221 | if ( isset($wp_filter['all']) ) { |
222 | $wp_current_filter[] = $tag; |
223 | $all_args = func_get_args(); |
224 | _wp_call_all_hook($all_args); |
225 | } |
226 |
|
Line | Code |
418 | * @since 1.2.0 |
419 | * |
420 | * @global array $wp_filter Stores all of the filters |
421 | * @global array $wp_actions Increments the amount of times action was triggered. |
422 | * |
423 | * @param string $tag The name of the action to be executed. |
424 | * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. |
425 | * @return null Will return null if $tag does not exist in $wp_filter array |
426 | */ |
427 | function do_action($tag, $arg = '') { |
428 | global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; |
429 |
|
430 | if ( ! isset($wp_actions[$tag]) ) |
431 | $wp_actions[$tag] = 1; |
432 | else |
433 | ++$wp_actions[$tag]; |
434 |
|
435 | // Do 'all' actions first |
436 | if ( isset($wp_filter['all']) ) { |
Line | Code |
502 | * @since 2.1.0 |
503 | * |
504 | * @global array $wp_filter Stores all of the filters |
505 | * @global array $wp_actions Increments the amount of times action was triggered. |
506 | * |
507 | * @param string $tag The name of the action to be executed. |
508 | * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt> |
509 | * @return null Will return null if $tag does not exist in $wp_filter array |
510 | */ |
511 | function do_action_ref_array($tag, $args) { |
512 | global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; |
513 |
|
514 | if ( ! isset($wp_actions[$tag]) ) |
515 | $wp_actions[$tag] = 1; |
516 | else |
517 | ++$wp_actions[$tag]; |
518 |
|
519 | // Do 'all' actions first |
520 | if ( isset($wp_filter['all']) ) { |