The day before yesterday we talked about the content of your website automatically pushed to Baidu, today, said, the site content initiative to push to Baidu.
Auto push that is super simple, add the auto push code to the bottom of the page (footer.php).
Proactive push is more complicated than automatic push, fortunately, our theme of the developer, has already put this function in, just need to set the parameters in the background can be.
Method: Background--appearance--Theme options--seo Settings--enable the article actively push to Baidu--input Baidu actively push the token value can be.
Baidu Initiative Push settings
So where does this value get? Open the Baidu Resource Center, add website can.
Portal: Https://ziyuan.baidu.com/linksubmit/index
Get Baidu Token value
In fact, the developer of this template, not only can be submitted to Baidu, can also be directly configured in the background Baidu Bear Paw, because my other website has the Bear Paw number, this site did not apply the Bear paw number.
Of course, if your theme developer does not have this configuration, write one yourself, insert the following code into the theme function file (functions.php) can be:
/* Baidu active Push code start */
if (!function_exists (' Baidu_submit ')) {
function Baidu_submit ($post _id) {
$WEB _token = '123456'; //Here please replace your website Baidu initiative to push the token value
$WEB _domain = get_option (' home ');
//The articles that have been successfully pushed are no longer pushed
if(Get_post_meta ($post _id, ' Baidusubmit ',true) ==1)return;
$url = Get_permalink ($post _id);
$api = ' http://data.zz.baidu.com/urls?site= '. $WEB _domain. ' &token= '. $WEB _token;
$request = new wp_http;
$result = $request->request ($api, Array (' method ' = ' POST ', ' body ' = = $url, ' headers ' = ' content-type:te Xt/plain '));
$result = Json_decode ($result [' body '],true);
//If push succeeds then add custom column Baidusubmit in the article, with a value of 1
if (Array_key_exists (' success ', $result)) {
Add_post_meta ($post _id, ' Baidusubmit ', 1, true);
}
}
Add_action (' Publish_post ', ' baidu_submit ', 0);
}
/* Baidu active Push code end */
Because my website has been actively pushed in the background configuration number, you can now view the relevant data of the Baidu Resource Center:
Baidu Push Data
Well, the article initiative to Baidu's tutorial will be here has been finished, so far, the initiative push + automatic push +sitemap 3 ways (manual submission Needless to say it), has all finished, finished these work, Baidu included your article content will be faster.
Source: Ze Industry construction Station Network
This article by Tze Industry original, published in 51CTO blog
Yang Zeyi: Actively push your website content to Baidu