Last active
April 12, 2017 13:46
-
-
Save EricBusch/005b798725ea4efd231b to your computer and use it in GitHub Desktop.
Delete all rows in the postmeta table which have the same meta_key. [wordpress]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$meta_type = 'post'; // Type of object metadata is for (e.g., comment, post, or user). | |
$object_id = 0; // Set to 0 as it will be ignored. | |
$meta_key = 'color'; // The target "meta_key" value to delete. | |
$meta_value = ''; // Ignored when $delete_all is TRUE. | |
$delete_all = true; // True to delete matching metadata entries for all objects, ignoring the specified object_id. | |
delete_metadata( $meta_type, $object_id, $meta_key, $meta_value, $delete_all ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment