Use metadata API in do_all_pings() to delete post meta (cleaner, plays better with cache). Remove redundant query to retrieve meta_id. See #18196.
git-svn-id: https://develop.svn.wordpress.org/trunk@18855 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
206aa49499
commit
46f95eb2de
@ -1664,20 +1664,14 @@ function do_all_pings() {
|
|||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
// Do pingbacks
|
// Do pingbacks
|
||||||
while ($ping = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
|
while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
|
||||||
$mid = $wpdb->get_var( "SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme' LIMIT 1");
|
delete_metadata_by_mid( 'post', $ping->meta_id );
|
||||||
do_action( 'delete_postmeta', $mid );
|
|
||||||
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->postmeta} WHERE meta_id = %d", $mid ) );
|
|
||||||
do_action( 'deleted_postmeta', $mid );
|
|
||||||
pingback( $ping->post_content, $ping->ID );
|
pingback( $ping->post_content, $ping->ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do Enclosures
|
// Do Enclosures
|
||||||
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
|
while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
|
||||||
$mid = $wpdb->get_var( $wpdb->prepare("SELECT meta_id FROM {$wpdb->postmeta} WHERE post_id = %d AND meta_key = '_encloseme'", $enclosure->ID) );
|
delete_metadata_by_mid( 'post', $enclosure->meta_id );
|
||||||
do_action( 'delete_postmeta', $mid );
|
|
||||||
$wpdb->query( $wpdb->prepare("DELETE FROM {$wpdb->postmeta} WHERE meta_id = %d", $mid) );
|
|
||||||
do_action( 'deleted_postmeta', $mid );
|
|
||||||
do_enclose( $enclosure->post_content, $enclosure->ID );
|
do_enclose( $enclosure->post_content, $enclosure->ID );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user