diff --git tests/phpunit/includes/functions.php tests/phpunit/includes/functions.php
index ce8ea69..a7ccb3a 100644
|
|
function tests_reset__SERVER() { |
23 | 23 | function tests_add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) { |
24 | 24 | global $wp_filter; |
25 | 25 | |
26 | | $idx = _test_filter_build_unique_id($tag, $function_to_add, $priority); |
27 | | $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); |
| 26 | $idx = _test_filter_build_unique_id( $tag, $function_to_add, $priority ); |
| 27 | |
| 28 | if ( class_exists( 'WP_Hook' ) ) { |
| 29 | if ( ! isset( $wp_filter[ $tag ] ) ) { |
| 30 | $wp_filter[ $tag ] = new WP_Hook(); |
| 31 | } |
| 32 | |
| 33 | $wp_filter[ $tag ]->callbacks[ $priority ][ $idx ] = array( |
| 34 | 'function' => $function_to_add, |
| 35 | 'accepted_args' => $accepted_args, |
| 36 | ); |
| 37 | } else { |
| 38 | // WP has not loaded yet. Hook will be normalized on WP bootstrap. |
| 39 | $wp_filter[$tag][$priority][$idx] = array('function' => $function_to_add, 'accepted_args' => $accepted_args); |
| 40 | } |
| 41 | |
28 | 42 | return true; |
29 | 43 | } |
30 | 44 | |