发送pingback。
原型
weblog_ping( string $server = '', string $path = '' )
参数
$server
(string)
(Optional)
主持人的博客连接。
$path
(string)
(Optional)
发送ping的路径。
源文件
路径:wp-includes/comment.php
<?php
...
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);
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/weblog_ping/