Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Improve handling of is_home flag when setting up the WP_Query object. #139

Open
joemcgill opened this issue Apr 29, 2020 · 1 comment
Open

Comments

@joemcgill
Copy link
Contributor

joemcgill commented Apr 29, 2020

When setting up the WP_Query object in Components_Endpoint::build_query(), the is_home flag is not being set correctly because internally, when WP_Query::parse_query() sets those flags, it explicitly includes a condition that the current request is not a REST request.

Since we are always setting up the WP_Query object in the context of a REST request, this will always be false. Annoyingly, the is_home flag is also then used in the logic to set up several other flags, which are now unreliable as well.

Our two options are to either manually set the is_home flag using the same basic logic as WordPress on the parse_query action and then rerun parse_query_vars() to fix inconsistencies, or we need to fork all of the logic that relies on the is_home flag and fix them all manually.

@joemcgill
Copy link
Contributor Author

Went dumpster diving through Trac and found this issue as the reason why WordPress decided to explicitly set is_home to false during REST requests: https://core.trac.wordpress.org/ticket/34373

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant