WordPress.org

Make WordPress Core

Ticket #36824: 36824-trackbacks.diff

File 36824-trackbacks.diff, 1.4 KB (added by boonebgorges, 5 months ago)
  • src/wp-includes/comment.php

    diff --git a/src/wp-includes/comment.php b/src/wp-includes/comment.php
    index 4b192ea02e..6b76ff4f2a 100644
    a b function do_all_pings() { 
    26452645                do_enclose( $enclosure->post_content, $enclosure->ID );
    26462646        }
    26472647
    2648         // Do Trackbacks
    2649         $trackbacks = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'" );
    2650         if ( is_array( $trackbacks ) ) {
    2651                 foreach ( $trackbacks as $trackback ) {
    2652                         do_trackbacks( $trackback );
    2653                 }
     2648        // Do trackbacks.
     2649        $trackbacks = get_posts(
     2650                array(
     2651                        'post_type'        => get_post_types(),
     2652                        'suppress_filters' => false,
     2653                        'nopaging'         => true,
     2654                        'meta_key'         => '_trackbackme',
     2655                        'fields'           => 'ids',
     2656                )
     2657        );
     2658
     2659        foreach ( $trackbacks as $trackback ) {
     2660                delete_post_meta( $trackback, '_trackbackme' );
     2661                do_trackbacks( $trackback );
    26542662        }
    26552663
    26562664        //Do Update Services/Generic Pings
  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index 15422a5f32..56b7317c6f 100644
    a b function _publish_post_hook( $post_id ) { 
    67866786        }
    67876787        add_post_meta( $post_id, '_encloseme', '1' );
    67886788
     6789        $to_ping = get_to_ping( $post_id );
     6790        if ( ! empty( $to_ping ) ) {
     6791                add_post_meta( $post_id, '_trackbackme', '1' );
     6792        }
     6793
    67896794        if ( ! wp_next_scheduled( 'do_pings' ) ) {
    67906795                wp_schedule_single_event( time(), 'do_pings' );
    67916796        }