導讀:最近遇到一個問題, 在 WordPress 編輯文章發佈的時候, 百度地圖插件 Baidu Sitemap Generator 會提示以下錯誤:Warning: Illegal string offs...
Warning: Illegal string offset 'lc_is_update_sitemap_when_post' in /home/cdkxcn/public_html/wp-content/plugins/baidu-sitemap-generator/baidu_sitemap.php on line 406 究其原因, 是百度地圖插件不能及時更新最新發布的文章導致的 bug, 以下是修復方法:
1 、打開 baidu-sitemap.php 文件並找到 第 406 行的以下代碼:
if($get_baidu_sitemap_options[' lc_is_update_sitemap_when_post '] == 』1′){
wp_clear_scheduled_hook(『do_baidu_sitemap_by_post』);
wp_clear_scheduled_hook(『do_this_auto_daily』);
wp_schedule_single_event(time()+10, 『do_baidu_sitemap_by_post』);
}
2 、把這段代碼註釋掉, 註釋後的代碼如下:
//if($get_baidu_sitemap_options[' lc_is_update_sitemap_when_post '] == 』1′){
wp_clear_scheduled_hook(『do_baidu_sitemap_by_post』);
wp_clear_scheduled_hook(『do_this_auto_daily』);
wp_schedule_single_event(time()+10, 『do_baidu_sitemap_by_post』);
//}
3 、修改 bug 的思路: 每當發佈文章時,sitemap 都會自動更新.