Query: Do not replace the posts page with the front page when previewing. - #13364
Query: Do not replace the posts page with the front page when previewing.#13364R1shabh-Gupta wants to merge 1 commit into
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
When a static front page and a separate posts page are configured, previewing the posts page incorrectly displays the front page.
WP_Query::parse_query()correctly identifies the request as bothis_homeandis_posts_page. However, inWP_Query::get_posts(), the front page preview logic only checksis_home, which is also true for the posts page. As a result, it replaces the requestedpage_idwithpage_on_front.That behavior is needed when previewing the static front page, since its preview URL is a bare
/?preview=true. This change avoids the substitution when the request explicitly targets the posts page.Steps to reproduce
"My posts".
Before this change the preview shows "My home". After it, "My posts".
Trac ticket: https://core.trac.wordpress.org/ticket/49969
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Opus 5
Used for: Code Review
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.