Consolidate post insertion APIs
|Reported by:||nacin||Owned by:||wonderboymusic|
|Component:||Posts, Post Types||Keywords:||has-patch needs-unit-tests 3.6-early|
In wp-includes, we have:
For saving from the admin, we have:
wp_publish_post() is, as of , now wraps wp_insert_post().
wp_update_post() is a fairly mundane wrapper of wp_insert_post(), but we really should eliminate the differences between the two functions and make it a straight-up wrapper.
wp_insert_attachment() was a fork of wp_insert_post(), and wp_insert_post() has gotten a lot of improvements that haven't reached wp_insert_attachment(). It doesn't take much to merge these two, though, and make wp_insert_attachment() a wrapper.
wp_write_post() calls edit_post() if it has a post ID. And since we have had a post ID since the days of auto-drafts, this function is dead code. It's wrapper, write_post(), can also be deprecated.
I'm attaching a patch that takes care of wp_insert_post(), wp_write_post(), and write_post(). wp_update_post() will require a bit more concentration.
Needs testing and unit tests.
Change History (46)
comment:13 @nacin — 2 years ago
- Keywords 3.6-early added
- Milestone changed from 3.5 to Future Release
- Owner changed from nacin to wonderboymusic
- Status changed from assigned to reviewing