Changes to execute-pings.php

In my disagreement with the powers-that-be of the WordPress creators and coders, I expressed the need for Trackbacks to take precedence over Pingbacks. They marked my trac ticket as WONTFIX so I did it myself.

I simply rearranged the order in which the pings are sent putting trackbacks before pingbacks:
// 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")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
do_enclose($enclosure->post_content, $enclosure->ID);
// Do Trackbacks
$trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status != 'draft'");
if ( is_array($trackbacks) ) {
foreach ( $trackbacks as $trackback ) {
// 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")) {
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
pingback($ping->post_content, $ping->ID);

It seems to be working and it makes much more sense this way.

You can download the updated file here.

You may then test this out by using this post. If you include a trackback and a ping back the trackback will be sent out first ensuring its reception.

This post is considered “Open Trackback” with no time limits.

8 replies on “Changes to execute-pings.php”

  1. It’s probably my fault because I copied the code and WordPress took out the opening <?php (as it should). I fixed my posts to include it. Sorry for the mixup.

    I’m going to post a copy for download.

  2. Pingback: MacBros' Place

Comments are closed.