weblog_ping()
weblog_ping( string $server = ”, string $path = ” ) 发送p…
weblog_ping( string $server = ”, string $path = ” )
发送pingback。
Send a pingback.
目录锚点:#参数#源码
参数(Parameters)
| 参数 | 类型 | 说明 |
|---|---|---|
| $server | (string) | 要连接到的博客主机。 |
| $path | (string) | 发送ping的路径。 |
源码(Source)
/**
* 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);
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.2.0 | wp-includes/comment.php | 19 | 2 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。





还没有任何评论,赶紧来占个楼吧!