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.

Built from https://develop.svn.wordpress.org/trunk@34605


git-svn-id: http://core.svn.wordpress.org/trunk@34569 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Weston Ruter 2015-09-26 20:54:25 +00:00
parent cc8df8ecb6
commit 7493641f86
2 changed files with 8 additions and 6 deletions

View File

@ -1631,13 +1631,15 @@ function _post_states($post) {
$post_states['scheduled'] = __( 'Scheduled' );
}
if ( get_option( 'page_on_front' ) == $post->ID ) {
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 ) {
if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
$post_states['page_for_posts'] = __( 'Posts Page' );
}
}
/**
* Filter the default post display states used in the posts list table.

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.4-alpha-34604';
$wp_version = '4.4-alpha-34605';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.