Actions for adding and deleting meta. Props wojtek.szkutnik mitchoyoshitaka. fixes #14173
git-svn-id: http://svn.automattic.com/wordpress/trunk@15917 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
920bf4e235
commit
2e486e7b10
|
@ -53,6 +53,8 @@ function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique =
|
|||
$_meta_value = $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(
|
||||
$column => $object_id,
|
||||
'meta_key' => $meta_key,
|
||||
|
@ -190,6 +192,8 @@ function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $d
|
|||
if ( !count( $meta_ids ) )
|
||||
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 ) . " )";
|
||||
|
||||
$count = $wpdb->query($query);
|
||||
|
|
Loading…
Reference in New Issue