[wp-trac] [WordPress Trac] #29550: Twenty Fourteen: Featured Content pre_get_posts method can incorrectly bail if front page gets set back to 'posts'
WordPress Trac
noreply at wordpress.org
Fri Sep 5 23:26:03 UTC 2014
#29550: Twenty Fourteen: Featured Content pre_get_posts method can incorrectly bail
if front page gets set back to 'posts'
---------------------------+-----------------------------
Reporter: kwight | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bundled Theme | Version: trunk
Severity: normal | Keywords:
Focuses: |
---------------------------+-----------------------------
Currently, the `pre_get_posts` filter will bail if the `page_on_front`
setting has a value. This value is set once the user chooses a static page
for the front page of their site.
{{{
$page_on_front = get_option( 'page_on_front' );
// Bail if the blog page is not the front page.
if ( ! empty( $page_on_front ) ) {
return;
}
}}}
However, that value is not affected if the user chooses to set their blog
back to posts on the front page, causing the above check to become
ineffective. Instead, let's check against the `show_on_front` option, for
a correct evaluation in all cases.
{{{
// Bail if the blog page is not the front page.
if ( 'posts' !== get_option( 'show_on_front' ) ) {
return;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/29550>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list