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:
<?php
require_once('../wp-config.php');
// 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_trackbacks($trackback->ID);
}
}
// 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.
The following have linked to this article:
- Diane’s Stuff » Blog Archive » Imagine Kitty- Smart Cat! pinged this post.
- MacBros’ Place » Nanny McPhee pinged this post.
- MacBros’ Place trackbacked with Wiiiiizzzz Zooooom!…







On 7Feb06 at 1417 WordPress Station » Blog Archive »
Trackbacks vs Pingbacks said:
[...] ★imaginekitty★ [...]
On 7Feb06 at 1738 David said:
Thanks! I’ll give this a whirl.
On 9Feb06 at 1347 jimmyb said:
Wow.
I’m impressed!!
On 11Feb06 at 1331 Diane's Stuff » Blog Archive » Imagine Kitty- Smart Cat! said:
[...] This morning I was on his site reading this post, “Changes to execute-pings.php” and I thought I’d try his fix. This involved changing the execute-pings.php as one might surmise, and I did so, then uploaded it to overwrite the old file. I then put it to the test by trackbacking to “third world county“. Yesterday I sent a trackback to David’s Friday OTA–more later post and it showed as a ping. The one I sent for the test to the same post showed as a trackback as it should have. Smart kitty [...]
On 11Feb06 at 2309 MacBros' Place » Nanny McPhee said:
[...] ——————— OTA links: Stop The ACLU OTA Weekend And Open Thread Point Five 7 Deadly Sins Gribbit’s World imaginekitty imaginekitty Test TB [...]
On 11Feb06 at 2312 MacBros said:
This doesn’t seem to work for me. So I went back to WP version.
On 11Feb06 at 2336 Mark said:
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.
On 1Nov06 at 1022 MacBros' Place said:
Wiiiiizzzz Zooooom!…
Wow! Has anybody noticed how much faster WordPress 2.0.5 – Ronan is? Pages are opening up nice and fast compared to the previous versions. It's making my site appear faster anyway. Just thought I'd ask. yo can all go back to doing w…