diff --git a/src/wp-includes/class-wp.php b/src/wp-includes/class-wp.php index 4acadadca1..4a3b42c795 100644 --- a/src/wp-includes/class-wp.php +++ b/src/wp-includes/class-wp.php @@ -215,7 +215,8 @@ class WP { } $post_status_obj = get_post_status_object( $page->post_status ); - if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private ) { + if ( ! $post_status_obj->public && ! $post_status_obj->protected + && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } } diff --git a/src/wp-includes/rewrite-functions.php b/src/wp-includes/rewrite-functions.php index 2f9be5ad99..829df3d1a5 100644 --- a/src/wp-includes/rewrite-functions.php +++ b/src/wp-includes/rewrite-functions.php @@ -403,7 +403,8 @@ function url_to_postid( $url ) { } $post_status_obj = get_post_status_object( $page->post_status ); - if ( ! $post_status_obj->public && ! $post_status_obj->protected && ! $post_status_obj->private ) { + if ( ! $post_status_obj->public && ! $post_status_obj->protected + && ! $post_status_obj->private && $post_status_obj->exclude_from_search ) { continue; } }