导读:最近遇到一个问题, 在 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 都会自动更新.