Actions for adding and deleting meta. Props wojtek.szkutnik mitchoyoshitaka. fixes #14173
git-svn-id: https://develop.svn.wordpress.org/trunk@15917 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
3e32b5318a
commit
fc73604019
@ -53,6 +53,8 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
|
|||||||
$_meta_value = $meta_value;
|
$_meta_value = $meta_value;
|
||||||
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
$meta_value = maybe_serialize( stripslashes_deep($meta_value) );
|
||||||
|
|
||||||
|
do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
|
||||||
|
|
||||||
$wpdb->insert( $table, array(
|
$wpdb->insert( $table, array(
|
||||||
$column => $object_id,
|
$column => $object_id,
|
||||||
'meta_key' => $meta_key,
|
'meta_key' => $meta_key,
|
||||||
@ -190,6 +192,8 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d
|
|||||||
if ( !count( $meta_ids ) )
|
if ( !count( $meta_ids ) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $meta_value );
|
||||||
|
|
||||||
$query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )";
|
$query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )";
|
||||||
|
|
||||||
$count = $wpdb->query($query);
|
$count = $wpdb->query($query);
|
||||||
|
Loading…
Reference in New Issue
Block a user