[wp-trac] [WordPress Trac] #39372: Allow count for wp_terms query to count other post statuses as well as published posts
WordPress Trac
noreply at wordpress.org
Fri Dec 30 04:19:00 UTC 2016
#39372: Allow count for wp_terms query to count other post statuses as well as
published posts
-------------------------------+------------------------------
Reporter: roperjonathan | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.7
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses: performance
-------------------------------+------------------------------
Comment (by dd32):
For reference; a hacky solution I've used elsewhere, such as on the
WordPress.org plugin directory, is to include a non-exitent post-type into
the taxonomy post_type list.
It causes WordPress to skip only counting `post_status = 'publish'` and
instead just counting the number of objects assigned to it, not looking at
the post table at all.
{{{
register_taxonomy( 'plugin_contributors', array( 'plugin', 'force-count-
to-include-all-post_status' ), $args );
}}}
https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html
/wp-content/plugins/plugin-directory/class-plugin-
directory.php?rev=4520&marks=201,217#L190
--
Ticket URL: <https://core.trac.wordpress.org/ticket/39372#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list