WordPress.org

Make WordPress Core

Changeset 46177


Ignore:
Timestamp:
09/19/2019 01:59:06 AM (2 months ago)
Author:
boonebgorges
Message:

Use WP_Query when sending pingbacks.

Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
See #36824.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment.php

    r46175 r46177  
    26342634    global $wpdb;
    26352635
    2636     // Do pingbacks
    2637     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" ) ) {
    2638         delete_metadata_by_mid( 'post', $ping->meta_id );
    2639         pingback( $ping->post_content, $ping->ID );
     2636    // Do pingbacks.
     2637    $pings = get_posts(
     2638        array(
     2639            'post_type'        => get_post_types(),
     2640            'suppress_filters' => false,
     2641            'nopaging'         => true,
     2642            'meta_key'         => '_pingme',
     2643            'fields'           => 'ids',
     2644        )
     2645    );
     2646
     2647    foreach ( $pings as $ping ) {
     2648        delete_post_meta( $ping, '_pingme' );
     2649        pingback( null, $ping );
    26402650    }
    26412651
Note: See TracChangeset for help on using the changeset viewer.