WordPress.org

Make WordPress Core

Opened 9 months ago

Last modified 9 months ago

#40521 new defect (bug)

Using a custom query var on a static front page results in wrong $post

Reported by: mechter Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.7.4
Component: Posts, Post Types Keywords:
Focuses: Cc:

Description

Steps to reproduce:

  • Create a page and make it the static front page
  • Add a new query var via filter in theme's functions.php: add_filter( 'query_vars', function( $vars ) { array_push( $vars, 'buggy' ); return $vars; } );
  • Open the front page setting the newly added query var (e.g. "https://example.com/?buggy=yep")

Result: displays the latest blog post
Expected result: displays front page

Change History (2)

#1 follow-up: @joyously
9 months ago

I was able to reproduce this using a child theme with TwentyFifteen as the parent. TwentyFifteen does not have a front-page.php file. Also on TwentySixteen, which does not have a front-page.php either.

Last edited 9 months ago by joyously (previous) (diff)

#2 in reply to: ↑ 1 @bhargavbhandari90
9 months ago

I am also replicating this.
Replying to joyously:

I was able to reproduce this using a child theme with TwentyFifteen as the parent. TwentyFifteen does not have a front-page.php file. Also on TwentySixteen, which does not have a front-page.php either.

Note: See TracTickets for help on using tickets.