[wp-trac] [WordPress Trac] #27335: wp_insert_post() inserts posts of unregistered post types
WordPress Trac
noreply at wordpress.org
Sun Mar 9 22:35:29 UTC 2014
#27335: wp_insert_post() inserts posts of unregistered post types
-------------------------------+------------------------------
Reporter: brocheafoin | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Posts, Post Types | Version: 3.8.1
Severity: normal | Resolution:
Keywords: | Focuses:
-------------------------------+------------------------------
Comment (by nacin):
I can't find my previous answer on this subject (may have been a ticket,
but can't find it) — but basically, we deliberately don't restrict post
types for compatibility reasons. Some were using the post_type field well
before register_post_type() existed, and even then, it doesn't ''need'' to
be an error condition. Most of WordPress won't recognize the post type,
but wp_insert_post() is a low-level API (it's also a high-level API; yes,
it's a problem) and doesn't care.
Adding an error now will likely cause other problems. I could picture a
situation where someone is registering a post type, but somehow does so
(at least in some situations) after a wp_insert_post() call.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27335#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list