[wp-trac] [WordPress Trac] #35603: Allow `wp_count_posts()` on multisite after switching sites

WordPress Trac noreply at wordpress.org
Mon Feb 1 15:50:49 UTC 2016

#35603: Allow `wp_count_posts()` on multisite after switching sites
 Reporter:  flixos90                    |       Owner:
     Type:  enhancement                 |      Status:  new
 Priority:  normal                      |   Milestone:  Awaiting Review
Component:  Posts, Post Types           |     Version:
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |     Focuses:  multisite

Comment (by flixos90):

 Replying to [comment:2 ocean90]:
 > Can you tell us your use case for this? Why are you trying to count
 posts of a post type which doesn't exist?

 I'm running a script which indexes all content on a WordPress multisite
 into Elasticsearch, content of different post types and such. This script
 iterates through the entire network (makes indexing requests with AJAX)
 and therefore it needs to retrieve all posts of all the post types that I
 need to index.

 However there are some post types that only exist on site A and others
 that only exist on site B. Thus, when I run the script from site A (and
 switch to B to index its content), it will get back a count of 0 for all
 post types from B that do not exist in A.

Ticket URL: <https://core.trac.wordpress.org/ticket/35603#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list