From ab7d1ae62dcd07344b4b35528cc75e9362f3959b Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 26 Sep 2015 20:53:32 +0000 Subject: [PATCH] Customize: Prevent showing "Front Page" and "Posts Page" states for pages in list table when `show_on_front` is not "page". Changing the `show_on_front` option back to "posts" also resets the `page_on_front` and `page_for_posts` options when updating via the Reading settings page. In the Customizer, however, this is not the case as these other options remain unchanged. This change accounts for this difference in behavior. Fixes #34004. git-svn-id: https://develop.svn.wordpress.org/trunk@34605 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/template-functions.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/wp-admin/includes/template-functions.php b/src/wp-admin/includes/template-functions.php index 54d0a0a889..91a50fc5a7 100644 --- a/src/wp-admin/includes/template-functions.php +++ b/src/wp-admin/includes/template-functions.php @@ -1631,12 +1631,14 @@ function _post_states($post) { $post_states['scheduled'] = __( 'Scheduled' ); } - if ( get_option( 'page_on_front' ) == $post->ID ) { - $post_states['page_on_front'] = __( 'Front Page' ); - } + if ( 'page' === get_option( 'show_on_front' ) ) { + if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) { + $post_states['page_on_front'] = __( 'Front Page' ); + } - if ( get_option( 'page_for_posts' ) == $post->ID ) { - $post_states['page_for_posts'] = __( 'Posts Page' ); + if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) { + $post_states['page_for_posts'] = __( 'Posts Page' ); + } } /**