[wp-trac] [WordPress Trac] #36217: WP_Post_Type class

WordPress Trac noreply at wordpress.org
Sat Mar 12 12:23:41 UTC 2016

#36217: WP_Post_Type class
 Reporter:  swissspidy         |      Owner:
     Type:  defect (bug)       |     Status:  new
 Priority:  normal             |  Milestone:  Awaiting Review
Component:  Posts, Post Types  |    Version:  2.9
 Severity:  normal             |   Keywords:  dev-feedback needs-patch
  Focuses:                     |
 I've been dealing with custom post types a lot lately and kept dealing
 with unhelpful post type objects (basically the post type args converted
 to an object).

 For example, `get_post_type_object()` does not provide any information
 about the available properties. `register_post_type()` does in some part,
 but the actual post type properties differ from the `$args` argument.

 A `WP_Post_Type` class would make this easier by helping with
 documentation and preventing accidental errors.

 The global `$wp_post_types` could be an array of `WP_Post_Type` objects.
 The class properties wouldn't change for backward compatibility and any
 class methods would only ''add'' some benefit to it.

 This ticket should:

 * Introduce the `WP_Post_Type` class and have base properties and methods
 for interacting with a post type object.
 * Apply the new class where it can be used within core.
 * Provide tests for any methods introduced.

 See also #32450 and #31985 for WP_Site and WP_Network classes.

Ticket URL: <https://core.trac.wordpress.org/ticket/36217>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list