weblog_ping

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

WordPress Version: 6.3

/**
 * Sends a pingback.
 *
 * @since 1.2.0
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    require_once ABSPATH . WPINC . '/class-IXR.php';
    require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // Using a timeout of 3 seconds should be enough to cover slow servers.
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' === $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . get_bloginfo('version');
    // When set to true, this outputs debug messages by itself.
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // Then try a normal ping.
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 6.1

/**
 * Sends a pingback.
 *
 * @since 1.2.0
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // Using a timeout of 3 seconds should be enough to cover slow servers.
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' === $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . get_bloginfo('version');
    // When set to true, this outputs debug messages by itself.
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // Then try a normal ping.
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 5.5

/**
 * Send a pingback.
 *
 * @since 1.2.0
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // Using a timeout of 3 seconds should be enough to cover slow servers.
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' === $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . get_bloginfo('version');
    // When set to true, this outputs debug messages by itself.
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // Then try a normal ping.
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 5.4

/**
 * Send a pingback.
 *
 * @since 1.2.0
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // Using a timeout of 3 seconds should be enough to cover slow servers.
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' == $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . get_bloginfo('version');
    // When set to true, this outputs debug messages by itself.
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // Then try a normal ping.
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 4.7

/**
 * Send a pingback.
 *
 * @since 1.2.0
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // using a timeout of 3 seconds should be enough to cover slow servers
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' == $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . get_bloginfo('version');
    // when set to true, this outputs debug messages by itself
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // then try a normal ping
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 4.3

/**
 * Send a pingback.
 *
 * @since 1.2.0
 *
 * @global string $wp_version
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    global $wp_version;
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // using a timeout of 3 seconds should be enough to cover slow servers
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' == $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . $wp_version;
    // when set to true, this outputs debug messages by itself
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // then try a normal ping
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 4.1

/**
 * Send a pingback.
 *
 * @since 1.2.0
 * @uses $wp_version
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    global $wp_version;
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // using a timeout of 3 seconds should be enough to cover slow servers
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' == $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . $wp_version;
    // when set to true, this outputs debug messages by itself
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // then try a normal ping
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}

WordPress Version: 3.7

/**
 * Send a pingback.
 *
 * @since 1.2.0
 * @uses $wp_version
 * @uses IXR_Client
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    global $wp_version;
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // using a timeout of 3 seconds should be enough to cover slow servers
    $client = new WP_HTTP_IXR_Client($server, (!strlen(trim($path)) || '/' == $path) ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . $wp_version;
    // when set to true, this outputs debug messages by itself
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // then try a normal ping
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}