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

WordPress Trac noreply at wordpress.org
Mon Apr 11 18:48:14 UTC 2016


#36217: WP_Post_Type class
----------------------------------------------+----------------------------
 Reporter:  swissspidy                        |       Owner:
     Type:  enhancement                       |      Status:  new
 Priority:  normal                            |   Milestone:  Future
Component:  Posts, Post Types                 |  Release
 Severity:  normal                            |     Version:  2.9
 Keywords:  dev-feedback has-patch 4.6-early  |  Resolution:
                                              |     Focuses:
----------------------------------------------+----------------------------

Comment (by flixos90):

 Maybe we should consider to handle everything that doesn't modify the post
 type object itself outside of the class and leave it in
 `register_post_type()`. Right now, some steps (like adding rewrite rules)
 happen in the `WP_Post_Type` constructor while others
 (`_future_post_hook`, registering taxonomies) remain in
 `register_post_type`.

 This would mean that the `WP_Post_Type` constructor only handles all its
 properties, while additional steps (like adding rewrite rules, query var
 etc would remain in `register_post_type()` (the `WP_Post_Type` class then
 wouldn't need to access `$wp` and `$wp_rewrite` for example). I actually
 like this approach a little more as `WP_Post_Type` would then only take
 care of itself and represent a post type, so if someone manually created
 an instance of the class, it wouldn't add any rewrite rules or cause other
 inconsistencies. And we also could possibly allow to insert this object
 directly into `register_post_type()` as a parameter at a later stage.

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


More information about the wp-trac mailing list