之前有个百度熊掌号,主打天级收录,现在改成快速收录了,之前都是每次发表之后去百度那手动更新,现在想想还是搞成自动的吧,省得费劲了~
代码:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
/** WordPress 发布文章主动推送到百度快速收录**/ if(!function_exists('Baidu_Submit')){ function Baidu_Submit($post_ID) { //已成功推送的文章不再推送 if(get_post_meta($post_ID,'Baidusubmit',true) == 1) return; $url = get_permalink($post_ID); $api = '这些写百度后台给的地址'; $ch = curl_init(); $options = array( CURLOPT_URL => $api, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_POSTFIELDS => $url, CURLOPT_HTTPHEADER => array('Content-Type: text/plain'), ); curl_setopt_array($ch, $options); $result = curl_exec($ch); $result = json_decode($result); if( $result->success_daily ){ add_post_meta($post_ID, 'Baidusubmit', 1, true); } } add_action('publish_post', 'Baidu_Submit', 0); } |
上面的地址从百度站长后台获取:
支持定时发布
同步更新到建站汇总文章。

马春杰杰




最新评论
站长您好,亚马逊云咨询推广资源,望建立联系,可邮件,谢谢。
换友情链接吗?
看你的站做的挺不错的
恭喜!!太强了,硕博连读啊
雁过留毛,人过留名。
看不懂但大受震撼
每天都在战争,希望2026和平.
ZeroTier 看过多篇帖子,目前群辉、飞牛os、win11 、安卓、ubuntu ≥18.04 顺利通过,这篇相对于简单 实用、特来感谢 🙄