Opened 12 years ago
Last modified 6 years ago
#24722 assigned defect (bug)
get_post_statuses() and get_page_statuses() are hardcoded
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | has-patch needs-refresh |
Focuses: | Cc: |
Description
Despite the support for registering custom post/page statuses in core, both get_post_statuses()
and get_page_statuses()
are hardcoded.
Both of these functions are only used in the XML-RPC API in core, however this may affect plugins.
(Somewhat related to the editorial-flow component, although that's on hiatus at the moment.)
Attachments (2)
Change History (11)
#1
follow-up:
↓ 3
@
12 years ago
Would it make sense to turn these into wrappers for get_post_stati()?
#2
@
12 years ago
See patch above. I didn't do the same thing for get_page_statuses()
because it looked like from the code that page statuses are supposed to be a different list from post_statuses and currently there is no way to filter the post status by post_type because post type is NOT considered in registering post status.
#3
in reply to:
↑ 1
@
12 years ago
Replying to sillybean:
Would it make sense to turn these into wrappers for get_post_stati()?
No, because get_post_stati() return a filtered list of objects. right now get_post_statuses() returns an array indexed in status->name/status->label pairs and any client code using the function would expect the same. I still use the $wp_post_statuses
global however, and created a helper function to spit out an array setup in the format using get_post_statuses()
currently expects.
#7
@
12 years ago
Related: #12706 (ticket:12706:17, ticket:12706:48).
#8
@
9 years ago
- Keywords needs-refresh added; editorial-flow removed
- Milestone changed from Future Release to 4.4
- Owner set to chriscct7
- Severity changed from minor to normal
- Status changed from new to assigned
#9
@
9 years ago
- Milestone changed from 4.4 to Future Release
24722.diff returns a map of non-internal statuses, but I'm not sure how useful this is. Without being able to associate object types to statuses, this is a very incomplete API.
make sure
get_post_statuses()
includes registered post stati