[wp-trac] [WordPress Trac] #35603: Allow `wp_count_posts()` on multisite after switching sites
WordPress Trac
noreply at wordpress.org
Tue Feb 2 17:11:18 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:4 dd32]:
> FWIW, I'm not sure we should support this (even if we technically can)
as it introduced an inconsistency in the CPT API.
> We end up with a situation where some functions work without the post
type registered, whereas others don't.
I see that it brings inconsistencies, but on the other hand it enhances
functionality. Since many parts of WordPress were built before Multisite
was a thing, it's almost impossible to make it fully compatible (without
breaking backwards compatibility). I personally would however prefer
inconsistent solutions over leaving those areas untouched. Furthermore,
regarding compatibility in this specific case, I actually was able to
query posts of a non-existent post type using `get_posts()`, but I was not
able to get the post count using `wp_count_posts()`, so it seems there
already is inconsistency there - not that this would justify my cause, but
I wanted to mention it.
The alternative for me is to hack around that problem as long as this is
not supported, but like I said, I would prefer it being solved in Core. It
is probably an edge-case at the moment - yet I think it shouldn't be
ignored.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/35603#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list