Precisely -what- data is sent to/from a wordpress blog when you enable trackbacks and pingbacks? Can I capture this data?

The Introduction To Blogging post on WordPress states that more data is being sent besides the URL, but precisely -what-… and how can I control it? ie. is the post excerpt being sent? Are the comments from the linking blog being received (and if so, how do I capture them?)

That blog post says that one uses HTTP and the other XML-RPC so I wonder if there is a single mechanism for capturing both types of data.

1 Answer
1

For pingbacks, it seems only the linked page/post and the page/post it linked
from are sent. Check out the pingback() function, specifically this line:

 $client->query( 'pingback.ping', $pagelinkedfrom, $pagelinkedto );

… where $client is an instance of WP_HTTP_IXR_Client. The query method uses IXR_Request to package up a simple XML document:

<?xml version="1.0"?>
<methodCall>
    <methodName>pingback.ping</methodName>
    <params>
        <param>
            <value>
                <string>[pagelinkedfrom]</string>
            </value>
        </param>
        <param>
            <value>
                <string>[pagelinkedto]</string>
            </value>
        </param>
    </params>
</methodCall>

… which is then sent to the pingback server URL (passed in when $client is instantiated).

Trackbacks, little more straightforward, and with a bit more data – see trackback():

$options['body'] = array(
    'title' => $title,
    'url' => get_permalink($ID),
    'blog_name' => get_option('blogname'),
    'excerpt' => $excerpt
);

// WP_Http will automatically convert body to a HTTP query string
$response = wp_safe_remote_post( $trackback_url, $options );

As for handling/intercepting the responses, check out the source of wp_xmlrpc_server::pingback_ping() in wp-includes/class-wp-xmlrpc-server.php for pings, and the file wp-trackback.php for trackbacks.

You’ll quickly see what actions/filters you have available, and how much you can interact with (& alter) the responses.

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *