trackback

The timeline below displays how wordpress function trackback has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Sends a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title         Title of post.
 * @param string $excerpt       Excerpt of post.
 * @param int    $post_id       Post ID.
 * @return int|false|void Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $post_id)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 10;
    $options['body'] = array('title' => $title, 'url' => get_permalink($post_id), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $post_id));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $post_id));
}

WordPress Version: 6.1

/**
 * Sends a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title         Title of post.
 * @param string $excerpt       Excerpt of post.
 * @param int    $ID            Post ID.
 * @return int|false|void Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $ID)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 10;
    $options['body'] = array('title' => $title, 'url' => get_permalink($ID), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
}

WordPress Version: 5.5

/**
 * Send a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title         Title of post.
 * @param string $excerpt       Excerpt of post.
 * @param int    $ID            Post ID.
 * @return int|false|void Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $ID)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 10;
    $options['body'] = array('title' => $title, 'url' => get_permalink($ID), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
}

WordPress Version: 4.4

/**
 * Send a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title Title of post.
 * @param string $excerpt Excerpt of post.
 * @param int $ID Post ID.
 * @return int|false|void Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $ID)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 10;
    $options['body'] = array('title' => $title, 'url' => get_permalink($ID), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
}

WordPress Version: 4.3

/**
 * Send a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title Title of post.
 * @param string $excerpt Excerpt of post.
 * @param int $ID Post ID.
 * @return int|false|void Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $ID)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 4;
    $options['body'] = array('title' => $title, 'url' => get_permalink($ID), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
}

WordPress Version: 4.1

/**
 * Send a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title Title of post.
 * @param string $excerpt Excerpt of post.
 * @param int $ID Post ID.
 * @return mixed Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $ID)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 4;
    $options['body'] = array('title' => $title, 'url' => get_permalink($ID), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
}

WordPress Version: 3.7

/**
 * Send a Trackback.
 *
 * Updates database when sending trackback to prevent duplicates.
 *
 * @since 0.71
 * @uses $wpdb
 *
 * @param string $trackback_url URL to send trackbacks.
 * @param string $title Title of post.
 * @param string $excerpt Excerpt of post.
 * @param int $ID Post ID.
 * @return mixed Database query from update.
 */
function trackback($trackback_url, $title, $excerpt, $ID)
{
    global $wpdb;
    if (empty($trackback_url)) {
        return;
    }
    $options = array();
    $options['timeout'] = 4;
    $options['body'] = array('title' => $title, 'url' => get_permalink($ID), 'blog_name' => get_option('blogname'), 'excerpt' => $excerpt);
    $response = wp_safe_remote_post($trackback_url, $options);
    if (is_wp_error($response)) {
        return;
    }
    $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
    return $wpdb->query($wpdb->prepare("UPDATE {$wpdb->posts} SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
}