Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#29550 closed defect (bug) (fixed)

Twenty Fourteen: Featured Content pre_get_posts method can incorrectly bail if front page gets set back to 'posts'

Reported by: kwight's profile kwight Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.8
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description

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;
}

Attachments (1)

29550.diff (556 bytes) - added by kwight 10 years ago.

Download all attachments as: .zip

Change History (4)

@kwight
10 years ago

#1 @SergeyBiryukov
10 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.1
  • Version changed from trunk to 3.8

#2 @SergeyBiryukov
10 years ago

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.

Confirmed when changing the front page via Customizer. See #28454.

#3 @SergeyBiryukov
10 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 29719:

Twenty Fourteen: Use correct check for the front page in Featured_Content::pre_get_posts().

props kwight.
fixes #29550.

Note: See TracTickets for help on using tickets.