只有拥有百度Sitemap实时推送功能的网站才能最大几率的保证站点的页面被抓取并且被收录,不过大多数站点并没有开通Sitemap权限,以下是引用百度官方对实时推送的介. 将代码加入至 functions.php: [cc lang=\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”php\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\”] function PushBaiDu($post_id,$post){ //百度推送接口地址 $Push = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’百度推送接口地址\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’; $PushUrl = get_permalink($post_id); $PushDate = $post->post_data; //构造推送xml数据 $PushXml = \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’

<![CDATA[\\\\\\\\\\\\\\\\'.$PushUrl.\\\\\\\\\\\\\\\\']]> \\\\\\\\\\\\\\\\'.$PushDate.\\\\\\\\\\\\\\\\' daily

0.9 \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’; //创建http请求对象 $wp_http_obj = new WP_Http(); //发送http post请求提交xml数据 return $wp_http_obj->post($Push, array(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’body\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ => $PushXml, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’headers\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ => array(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’Content-Type\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’ => \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’text/xml\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’))); } add_action(\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’publish_post\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’, \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’PushBaiDu\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\’); [/cc] 将$Push变量的值替换为你们的百度 Sitemap 实时推送接口调用地址,如果您的站点没有开通百度 Sitemap 权限则此代码不可用。 Sitemap实时推送接口获取地址:http://zhanzhang.baidu.com/sitemap/pingadd

相关新闻

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注

联系我们

联系我们

151-1101-0018

在线咨询:
邮件:30115776@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信
关注微信
分享本页
返回顶部