|Reported by:||swissspidy||Owned by:||swissspidy|
|Component:||Posts, Post Types||Keywords:||has-patch has-unit-tests|
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.
Change History (45)
13 months ago
- Keywords 4.6-early added
- Milestone changed from Awaiting Review to Future Release
- Keywords dev-feedback removed
- Resolution set to fixed
- Status changed from assigned to closed