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 3 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 |
290 | * @subpackage Plugin |
291 | * @since 1.2 |
292 | * @global array $wp_filter Stores all of the filters |
293 | * @global array $wp_actions Increments the amount of times action was triggered. |
294 | * |
295 | * @param string $tag The name of the action to be executed. |
296 | * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. |
297 | * @return null Will return null if $tag does not exist in $wp_filter array |
298 | */ |
299 | function do_action($tag, $arg = '') { |
300 | global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; |
301 |
|
302 | if ( is_array($wp_actions) ) |
303 | $wp_actions[] = $tag; |
304 | else |
305 | $wp_actions = array($tag); |
306 |
|
307 | $wp_current_filter[] = $tag; |
308 |
|
Line | Code |
373 | * @subpackage Plugin |
374 | * @since 2.1 |
375 | * @global array $wp_filter Stores all of the filters |
376 | * @global array $wp_actions Increments the amount of times action was triggered. |
377 | * |
378 | * @param string $tag The name of the action to be executed. |
379 | * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt> |
380 | * @return null Will return null if $tag does not exist in $wp_filter array |
381 | */ |
382 | function do_action_ref_array($tag, $args) { |
383 | global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; |
384 |
|
385 | if ( !is_array($wp_actions) ) |
386 | $wp_actions = array($tag); |
387 | else |
388 | $wp_actions[] = $tag; |
389 |
|
390 | $wp_current_filter[] = $tag; |
391 |
|