[wp-trac] [WordPress Trac] #18833: Pass raw data into save_post/wp_insert_post

WordPress Trac wp-trac at lists.automattic.com
Sun Oct 2 02:03:25 UTC 2011


#18833: Pass raw data into save_post/wp_insert_post
----------------------------+------------------------------
 Reporter:  rmccue          |       Owner:  rmccue
     Type:  enhancement     |      Status:  new
 Priority:  normal          |   Milestone:  Awaiting Review
Component:  Administration  |     Version:
 Severity:  normal          |  Resolution:
 Keywords:  has-patch       |
----------------------------+------------------------------

Comment (by rmccue):

 Replying to [comment:11 scribu]:
 > > Almost all tutorials about custom metaboxes (in addition to post meta)
 use $_POST to get the data that was submitted. Unfortunately, this breaks
 if a plugin uses anything that calls wp_insert_post() in the same request.
 >
 > Why is that?

 If a plugin tries to add a post manually (by passing in a data array), all
 data will be taken from this for `wp_insert_post`. However, these metabox
 callbacks will instead get the data from `$_POST`, and hence, the wrong
 data will be added.

 This patch enables the metaboxes to use the data that is passed in. For a
 POST request, this is the `$_POST` data. For a manual insert by a plugin,
 it will be the data that is passed in.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18833#comment:12>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list