導讀:最近遇到一個問題, 在 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 都會自動更新.