Make WordPress Core

Opened 13 years ago

Last modified 3 months ago

#24722 assigned defect (bug)

get_post_statuses() and get_page_statuses() are hardcoded

Reported by: rmccue Owned by: chriscct7
Priority: normal Milestone:
Component: Posts, Post Types Version:
Severity: normal Keywords: has-patch
Cc: Focuses:

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)

24722-full.diff (1.8 KB ) - added by nerrad 13 years ago.
make sure get_post_statuses() includes registered post stati
24722.diff (717 bytes ) - added by wonderboymusic 11 years ago.

Download all attachments as: .zip

Change History (12)

@nerrad
13 years ago

make sure get_post_statuses() includes registered post stati

#1 follow-up: @sillybean
13 years ago

Would it make sense to turn these into wrappers for get_post_stati()?

#2 @nerrad
13 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 @nerrad
13 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.

#4 @nerrad
13 years ago

  • Keywords has-patch added

#5 @nofearinc
13 years ago

  • Cc mario@… added

#6 @sillybean
13 years ago

  • Cc steph@… added

#8 @chriscct7
11 years ago

  • Keywords needs-refresh added; editorial-flow removed
  • Milestone Future Release4.4
  • Owner set to chriscct7
  • Severity minornormal
  • Status newassigned

#9 @wonderboymusic
11 years ago

  • Milestone 4.4Future 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.

This ticket was mentioned in PR #12067 on WordPress/wordpress-develop by @sainathpoojary.


3 months ago
#10

  • Keywords needs-refresh removed

Trac ticket: #24722

Note: See TracTickets for help on using tickets.