Changeset 18500 for trunk/wp-includes/post.php
- Timestamp:
- 08/03/2011 04:48:37 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r18472 r18500 1498 1498 */ 1499 1499 function delete_post_meta_by_key($post_meta_key) { 1500 if ( !$post_meta_key ) 1501 return false; 1502 1503 global $wpdb; 1504 $post_ids = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT post_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key)); 1505 if ( $post_ids ) { 1506 $postmetaids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = %s", $post_meta_key ) ); 1507 $in = implode( ',', array_fill(1, count($postmetaids), '%d')); 1508 do_action( 'delete_postmeta', $postmetaids ); 1509 $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id IN($in)", $postmetaids )); 1510 do_action( 'deleted_postmeta', $postmetaids ); 1511 foreach ( $post_ids as $post_id ) 1512 wp_cache_delete($post_id, 'post_meta'); 1513 return true; 1514 } 1515 return false; 1500 return delete_metadata( 'post', null, $post_meta_key, '', true ); 1516 1501 } 1517 1502
Note: See TracChangeset
for help on using the changeset viewer.