From acce286d346cc0d6fe9a7820b708e6648b9cb6a4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Thu, 15 Oct 2015 17:52:36 +0000 Subject: [PATCH] In `WP::parse_request()` and `url_to_postid()`, don't skip objects that have a post status with `'exclude_from_search' => false`, e.g. `inherit`. This fixes pretty permalinks for attachments, broken in [35195]. Fixes #21970. git-svn-id: https://develop.svn.wordpress.org/trunk@35205 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp.php | 3 ++- src/wp-includes/rewrite-functions.php | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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; } }