WordPress fast-tracks the API submission code SEO optimization.

. WordPress fast-tracks the API submission code (method: add the following code to the bottom of the fights.php file for your WordPress currently used theme, remember to add its own API interface address)./ WordPress fast-receiving API submission code

/ New 100-degree rapid call to api achieve receipt of add_action (‘save_post’, ‘fanly_baidu_dailysubmit’, 10, 3); funct_baidu_dailysubmit ($post_id, $post, $update) {$post->post_status != ‘publish’ || get_post_meta($post_id,’Fanly_Submit’,true)==’OK’) return;
$api = ‘GUwI6uKrTpu1q0T2’;//快速收录推送接口
$response = wp_remote_post($api, array(
‘headers’ => array(‘Accept-Encoding’=>”,’Content-Type’=>’text/plain’),
‘sslverify’ => false,
‘blocking’ => false,
‘body’ => get_permalink($post_id)
));
if ( !is_wp_error( $response ) ) {
$res = json_decode($response[‘body’], true);
if($res[‘success_daily’]==1)update_post_meta($post_id, ‘Fanly_Submit’, ‘OK’);// OK 避免重复提交
}
}

未经允许不得转载:萌萌Apprentissage » WordPress fast-tracks the API submission code SEO optimization.

Like (0) 打赏

Comments 0

Protected with IP Blacklist CloudIP Blacklist Cloud
  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

//下一个脚本特效
//下一个脚本