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 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4400.html
workflows工作流
ai图片扩大comfyui工作流
一只蚊子被嵌在琥珀中ComfyUI工作流
金属埃及人ComfyUI工作流
树上一个快乐的猕猴桃ComfyUI工作流
羚羊安上小白兔的门牙ComfyUI工作流
一个迷人的女人ComfyUI工作流
嘴唇丰满的漂亮女人
穿着蘑菇帽的小蚂蚁探险家ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!