Ticket #2871: 2871.diff
File 2871.diff, 1.5 KB (added by , 9 years ago) |
---|
-
src/includes/core/template-functions.php
314 314 // Add 'bbp_template_stack' to the current filter array 315 315 $wp_current_filter[] = $tag; 316 316 317 // Bail if no stack setup318 if ( empty( $wp_filter[ $tag ] ) ) {319 return array();320 }317 if ( class_exists( 'WP_Hook' ) ) { 318 $filter = $wp_filter[ $tag ]->callbacks; 319 } else { 320 $filter = &$wp_filter[ $tag ]; 321 321 322 // Sort 323 if ( ! isset( $merged_filters[ $tag ] ) ) { 324 ksort( $wp_filter[ $tag ] ); 325 $merged_filters[ $tag ] = true; 322 // Sort 323 if ( ! isset( $merged_filters[ $tag ] ) ) { 324 ksort( $filter ); 325 $merged_filters[ $tag ] = true; 326 } 326 327 } 327 328 328 329 // Ensure we're always at the beginning of the filter array 329 reset( $ wp_filter[ $tag ]);330 reset( $filter ); 330 331 331 332 // Loop through 'bbp_template_stack' filters, and call callback functions 332 333 do { 333 foreach ( (array) current( $ wp_filter[ $tag ]) as $the_ ) {334 foreach ( (array) current( $filter ) as $the_ ) { 334 335 if ( ! is_null( $the_['function'] ) ) { 335 336 $args[1] = $stack; 336 337 $stack[] = call_user_func_array( $the_['function'], array_slice( $args, 1, (int) $the_['accepted_args'] ) ); 337 338 } 338 339 } 339 } while ( next( $ wp_filter[ $tag ]) !== false );340 } while ( next( $filter ) !== false ); 340 341 341 342 // Remove 'bbp_template_stack' from the current filter array 342 343 array_pop( $wp_current_filter );