Ticket #5232: wp-current-filter-r6720.patch
| File wp-current-filter-r6720.patch, 1.5 KB (added by tellyworth, 5 years ago) |
|---|
-
wordpress/wp-includes/plugin.php
40 40 * @return string The text in <tt>$string</tt> after all hooked functions are applied to it. 41 41 */ 42 42 function apply_filters($tag, $string) { 43 global $wp_filter, $merged_filters ;43 global $wp_filter, $merged_filters, $wp_current_filter; 44 44 45 45 if ( !isset( $merged_filters[ $tag ] ) ) 46 46 merge_filters($tag); … … 51 51 reset( $wp_filter[ $tag ] ); 52 52 53 53 $args = func_get_args(); 54 55 $last_filter = @$wp_current_filter; 56 $wp_current_filter = $tag; 54 57 55 58 do{ 56 59 foreach( (array) current($wp_filter[$tag]) as $the_ ) … … 61 64 62 65 } while ( next($wp_filter[$tag]) !== false ); 63 66 67 $wp_current_filter = $last_filter; 68 64 69 return $string; 65 70 } 66 71 … … 138 143 * @param mixed $arg,... Optional additional arguments which are passed on to the functions hooked to the action. 139 144 */ 140 145 function do_action($tag, $arg = '') { 141 global $wp_filter, $wp_actions ;146 global $wp_filter, $wp_actions, $wp_current_action; 142 147 143 148 if ( is_array($wp_actions) ) 144 149 $wp_actions[] = $tag; … … 158 163 if ( !isset($wp_filter[$tag]) ) 159 164 return; 160 165 166 $last_action = @$wp_current_action; 167 $wp_current_action = $tag; 168 161 169 do{ 162 170 foreach( (array) current($wp_filter[$tag]) as $the_ ) 163 171 if ( !is_null($the_['function']) ) … … 165 173 166 174 } while ( next($wp_filter[$tag]) !== false ); 167 175 176 $wp_current_action = $last_action; 168 177 } 169 178 170 179 /**
