mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 17:18:32 +01:00
Ajax post meta fixes from mdawaffe. fixes #3098
git-svn-id: http://svn.automattic.com/wordpress/trunk@4157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
02ad124b46
commit
e41db03b26
@ -158,22 +158,19 @@ case 'add-meta' :
|
||||
if ( !current_user_can( 'edit_post', $id ) )
|
||||
die('-1');
|
||||
if ( $id < 0 ) {
|
||||
if ( $pid = write_post() )
|
||||
$meta = has_meta( $pid );
|
||||
if ( $pid = wp_insert_post() )
|
||||
$mid = add_meta( $pid );
|
||||
else
|
||||
die('0');
|
||||
$key = $meta[0]['meta_key'];
|
||||
$value = $meta[0]['meta_value'];
|
||||
$mid = (int) $meta[0]['meta_id'];
|
||||
} else {
|
||||
if ( $mid = add_meta( $id ) )
|
||||
$meta = get_post_meta_by_id( $mid );
|
||||
else
|
||||
die('0');
|
||||
$key = $meta->meta_key;
|
||||
$value = $meta->meta_value;
|
||||
$pid = (int) $meta->post_id;
|
||||
} else if ( !$mid = add_meta( $id ) ) {
|
||||
die('0');
|
||||
}
|
||||
|
||||
$meta = get_post_meta_by_id( $mid );
|
||||
$key = $meta->meta_key;
|
||||
$value = $meta->meta_value;
|
||||
$pid = (int) $meta->post_id;
|
||||
|
||||
$r = "<?xml version='1.0' standalone='yes'?><ajaxresponse>";
|
||||
$r .= wp_ajax_echo_meta( $pid, $mid, $key, $value );
|
||||
$r .= '</ajaxresponse>';
|
||||
|
Loading…
Reference in New Issue
Block a user