From aa7d063af28fa8b7008b066591101bae33341851 Mon Sep 17 00:00:00 2001 From: Boone Gorges Date: Thu, 19 Sep 2019 02:00:55 +0000 Subject: [PATCH] Use `WP_Query` when sending pingbacks. Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire. See #36824. Built from https://develop.svn.wordpress.org/trunk@46177 git-svn-id: http://core.svn.wordpress.org/trunk@45989 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/comment.php | 18 ++++++++++++++---- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/wp-includes/comment.php b/wp-includes/comment.php index 304536b9d2..51bd9e3b61 100644 --- a/wp-includes/comment.php +++ b/wp-includes/comment.php @@ -2633,10 +2633,20 @@ function discover_pingback_server_uri( $url, $deprecated = '' ) { function do_all_pings() { global $wpdb; - // Do pingbacks - 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" ) ) { - delete_metadata_by_mid( 'post', $ping->meta_id ); - pingback( $ping->post_content, $ping->ID ); + // Do pingbacks. + $pings = get_posts( + array( + 'post_type' => get_post_types(), + 'suppress_filters' => false, + 'nopaging' => true, + 'meta_key' => '_pingme', + 'fields' => 'ids', + ) + ); + + foreach ( $pings as $ping ) { + delete_post_meta( $ping, '_pingme' ); + pingback( null, $ping ); } // Do enclosures. diff --git a/wp-includes/version.php b/wp-includes/version.php index 4881ff9c1f..21f3ef2f93 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-46176'; +$wp_version = '5.3-alpha-46177'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.