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 |
---|---|
1096 | if ($day != $previousday) { |
1097 | return(1); |
1098 | } else { |
1099 | return(0); |
1100 | } |
1101 | } |
1102 |
|
1103 | // Filters: these are the core of WP's plugin architecture |
1104 |
|
1105 | function apply_filters($tag, $string) { |
1106 | global $wp_filter; |
1107 | if (isset($wp_filter['all'])) { |
1108 | foreach ($wp_filter['all'] as $priority => $functions) { |
1109 | if (isset($wp_filter[$tag][$priority])) |
1110 | $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], $wp_filter[$tag][$priority]); |
1111 | else |
1112 | $wp_filter[$tag][$priority] = array_merge($wp_filter['all'][$priority], array()); |
1113 | $wp_filter[$tag][$priority] = array_unique($wp_filter[$tag][$priority]); |
1114 | } |
Line | Code |
1145 | } |
1146 | $wp_filter[$tag]["$priority"] = $new_function_list; |
1147 | } |
1148 | //die(var_dump($wp_filter)); |
1149 | return true; |
1150 | } |
1151 |
|
1152 | // The *_action functions are just aliases for the *_filter functions, they take special strings instead of generic content |
1153 |
|
1154 | function do_action($tag, $string) { |
1155 | return apply_filters($tag, $string); |
1156 | } |
1157 |
|
1158 | function add_action($tag, $function_to_add, $priority = 10) { |
1159 | add_filter($tag, $function_to_add, $priority); |
1160 | } |
1161 |
|
1162 | function remove_action($tag, $function_to_remove, $priority = 10) { |
1163 | remove_filter($tag, $function_to_remove, $priority); |
1164 | } |