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
This commit is contained in:
Weston Ruter 2015-09-26 20:53:32 +00:00
parent 19b0ea5a8c
commit ab7d1ae62d

View File

@ -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' );
}
}
/**