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

Feature/implement irving is main query #272

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

jameswburke
Copy link
Contributor

No description provided.

@@ -349,6 +359,7 @@ public function build_query() {
// This ensures we always parse the query so is_home and other flags
// get properly set before we handle template.
if ( empty( $query ) ) {
$wp_query->query( $query );
Copy link
Contributor Author

@jameswburke jameswburke Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joemcgill, I think we should consider adding this call to query().

If $query is empty in the constructor, then query() never runs, which means get_posts() doesn't run, which means the pre_get_posts hook never runs.

Which means, pre_get_posts never runs on the index/home/front-page query, because $query is an empty string.

Looking for a gut-check from you if this makes sense, or there's something I'm not seeing here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense, though I'm curious what happens on a traditional home page load. I assume we are needing to work around this because normally on a home page load the query args would not be empty.

If we add this call to query() here we should be able to remove the parse_query() call below, since WP_Query::query() calls WP_Query::get_posts(), which calls WP_Query::parse_query() under the hood (see code).

@laurenfern laurenfern changed the base branch from master to main October 21, 2020 22:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants