weblog_ping( string $server = '', string $path = '' )

Send a pingback.


Description Description


Parameters Parameters

$server

(string) (Optional) Host of blog to connect to.

Default value: ''

$path

(string) (Optional) Path to send the ping.

Default value: ''


Top ↑

Source Source

File: wp-includes/comment.php

2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
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 );
    }
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.