diff --git a/tests/phpunit/tests/url.php b/tests/phpunit/tests/url.php index 177a7a889e..4d962d61e3 100644 --- a/tests/phpunit/tests/url.php +++ b/tests/phpunit/tests/url.php @@ -281,6 +281,8 @@ class Tests_URL extends WP_UnitTestCase { sleep( 1 ); // get_adjacent_post() doesn't handle posts created in the same second. $post_id2 = $this->factory->post->create(); + if ( ! isset( $GLOBALS['post'] ) ) + $GLOBALS['post'] = null; $orig_post = $GLOBALS['post']; $GLOBALS['post'] = get_post( $post_id2 );