[wp-trac] [WordPress Trac] #36687: Feature to override WP_Query to provide results from other source
WordPress Trac
noreply at wordpress.org
Thu Jun 16 01:37:47 UTC 2016
#36687: Feature to override WP_Query to provide results from other source
-----------------------------+--------------------------
Reporter: jpdavoutian | Owner: jpdavoutian
Type: feature request | Status: reopened
Priority: normal | Milestone: 4.6
Component: Query | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-----------------------------+--------------------------
Changes (by boonebgorges):
* status: closed => reopened
* resolution: fixed =>
Comment:
@jadpm Thanks very much for the details.
There is indeed a bug: moving the call to `set_found_posts()` meant that,
in some cases, another query was being run between the main
`$this->request` and `SELECT FOUND_ROWS()`: the query was triggered by
`_prime_post_caches()`. As such, `SELECT FOUND_ROWS()` was matching the
found rows from the cache-priming query rather than the main query. These
are the "random" results you're seeing.
`set_found_posts()` has to go back immediately after the main queries have
taken place. I'll enforce this with a test or two.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36687#comment:27>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list