Restrict meta update/delete to the current post. Props kawauso. fixes #15276
git-svn-id: https://develop.svn.wordpress.org/trunk@17078 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
c460268d15
commit
b677baf564
@ -192,14 +192,24 @@ function edit_post( $post_data = null ) {
|
|||||||
|
|
||||||
// Meta Stuff
|
// Meta Stuff
|
||||||
if ( isset($post_data['meta']) && $post_data['meta'] ) {
|
if ( isset($post_data['meta']) && $post_data['meta'] ) {
|
||||||
foreach ( $post_data['meta'] as $key => $value )
|
foreach ( $post_data['meta'] as $key => $value ) {
|
||||||
|
if ( !$meta = get_post_meta_by_id( $key ) )
|
||||||
|
continue;
|
||||||
|
if ( $meta->post_id != $post_ID )
|
||||||
|
continue;
|
||||||
update_meta( $key, $value['key'], $value['value'] );
|
update_meta( $key, $value['key'], $value['value'] );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) {
|
if ( isset($post_data['deletemeta']) && $post_data['deletemeta'] ) {
|
||||||
foreach ( $post_data['deletemeta'] as $key => $value )
|
foreach ( $post_data['deletemeta'] as $key => $value ) {
|
||||||
|
if ( !$meta = get_post_meta_by_id( $key ) )
|
||||||
|
continue;
|
||||||
|
if ( $meta->post_id != $post_ID )
|
||||||
|
continue;
|
||||||
delete_meta( $key );
|
delete_meta( $key );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
add_meta( $post_ID );
|
add_meta( $post_ID );
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user