[wp-trac] [WordPress Trac] #31154: register_post_type function does not check reserved post_types

WordPress Trac noreply at wordpress.org
Wed Jan 28 23:42:22 UTC 2015


#31154: register_post_type function does not check reserved post_types
-------------------------------+------------------------------
 Reporter:  sebastiaandegeus   |       Owner:
     Type:  enhancement        |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  trunk
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by tyxla):

 I agree that something must be done on this one, as using one of the
 reserved/disallowed post types may result in unexpected results which can
 be difficult to locate/debug for some developers.

 The above solution can work for core post types too, if we build the logic
 around the `_built_in` property. Basically, `register_post_type()` should
 allow the reserved post types `post`, `page`, `attachment`, `revision` and
 `nav_menu_item` to be registered again, but only with `_built_in = true`.
 And the disallowed post type names `action`, 'order' and `theme` should
 not be allowed at all.

 Attaching a patch for that.

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


More information about the wp-trac mailing list