
wordpress如何检测当前页面是否已被百度收录,下面web建站小编给大家简单介绍一下具体实现方法!
在functions.php中新增以下代码:
function baiduSL($url){
$url='http://www.baidu.com/s?wd='.$url;
$curl=curl_init();
curl_setopt($curl,CURLOPT_URL,$url);
curl_setopt($curl,CURLOPT_RETURNTRANSFER,1);
$rs=curl_exec($curl);
curl_close($curl);
if(!strpos($rs,'没有找到')){
return 1;
}else{
return 0;
}
}
add_filter( 'the_content', 'baidu_submit' );
function baidu_submit( $content ) {
if( is_single() && current_user_can( 'manage_options') )
if(baiduSL(get_permalink()) == 1)
echo '<p align=right><b><a target="_blank" title="点击查看" rel="external nofollow" href="https://www.baidu.com/s?wd='.get_the_title().'">此文章已被百度收录</a></b>(仅管理员可见)</p>';
else
$content="<p align=right><b><a style=color:red target=_blank href=https://zhanzhang.baidu.com/sitesubmit/index?sitename=".get_permalink().">百度未收录!点击此处一键提给百度交</a></b>(仅管理员可见)</p>".$content;
return $content;
}
WordPress如何利用Python脚本实现文章定时发布功能
标签: wordpress建站技巧, wordpress检测收录, wordpress百度收录
上面是“wordpress如何检测当前页面是否已被百度收录”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://m.ipkd.cn/webs_4400.html
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

wordpress搭建视频网,视频加载慢怎么解决