Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement full WP_Query support #246

westonruter opened this issue Sep 4, 2016 · 0 comments


None yet
1 participant
Copy link

commented Sep 4, 2016

Ensuring that the posts returned from a WP_Query accurately reflect the previewed post changes is a big deficiency in the plugin currently. The current logic to handle this looks at the query vars and then injects additional ID IN (…) and ID NOT IN (…) conditions to the WHERE clause. See WP_Customize_Posts_Preview::filter_posts_where_to_include_previewed_posts() which applies on the posts_where filter. That method currently has a todo:

There are undoubtedly hundreds of possible conditions that are not being accounted for in regards to all of the possible query vars a WP_Query can take.

There is also the problem of making sure that newly-created customized posts (which have an underlying auto-draft state and which have 0000-00-00 as the date) appear in the proper order (the logic in \WP_Customize_Posts_Preview::filter_the_posts_to_preview_settings() is insufficient because it is not aware of pagination).

I've been thinking that what we basically have to replicate the logic in WP_Query to augment the query results as required to accurately preview changes. Search indexes commonly intercept the query vars and add filters to get the results from another source and inject them via filtering the_posts. See

In WP 4.6 there is a new option and that is the new posts_pre_query filter in 4.6. (See ticket #36687.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.