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 |
---|---|
122 | * @global array $wp_filter Stores all of the filters |
123 | * @global array $merge_filters Merges the filter hooks using this function. |
124 | * @global array $wp_current_filter stores the list of current filters with the current one last |
125 | * |
126 | * @param string $tag The name of the filter hook. |
127 | * @param mixed $value The value on which the filters hooked to <tt>$tag</tt> are applied on. |
128 | * @param mixed $var,... Additional variables passed to the functions hooked to <tt>$tag</tt>. |
129 | * @return mixed The filtered value after all hooked functions are applied to it. |
130 | */ |
131 | function apply_filters($tag, $value) { |
132 | global $wp_filter, $merged_filters, $wp_current_filter; |
133 |
|
134 | $args = array(); |
135 | $wp_current_filter[] = $tag; |
136 |
|
137 | // Do 'all' actions first |
138 | if ( isset($wp_filter['all']) ) { |
139 | $args = func_get_args(); |
140 | _wp_call_all_hook($args); |
Line | Code |
262 | * @subpackage Plugin |
263 | * @since 1.2 |
264 | * @global array $wp_filter Stores all of the filters |
265 | * @global array $wp_actions Increments the amount of times action was triggered. |
266 | * |
267 | * @param string $tag The name of the action to be executed. |
268 | * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. |
269 | * @return null Will return null if $tag does not exist in $wp_filter array |
270 | */ |
271 | function do_action($tag, $arg = '') { |
272 | global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; |
273 |
|
274 | if ( is_array($wp_actions) ) |
275 | $wp_actions[] = $tag; |
276 | else |
277 | $wp_actions = array($tag); |
278 |
|
279 | $wp_current_filter[] = $tag; |
280 |
|
Line | Code |
345 | * @subpackage Plugin |
346 | * @since 2.1 |
347 | * @global array $wp_filter Stores all of the filters |
348 | * @global array $wp_actions Increments the amount of times action was triggered. |
349 | * |
350 | * @param string $tag The name of the action to be executed. |
351 | * @param array $args The arguments supplied to the functions hooked to <tt>$tag</tt> |
352 | * @return null Will return null if $tag does not exist in $wp_filter array |
353 | */ |
354 | function do_action_ref_array($tag, $args) { |
355 | global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter; |
356 |
|
357 | if ( !is_array($wp_actions) ) |
358 | $wp_actions = array($tag); |
359 | else |
360 | $wp_actions[] = $tag; |
361 |
|
362 | $wp_current_filter[] = $tag; |
363 |
|