最近遇到一個問題,在wordpress編輯文章發布的時候,百度地圖插件Baidu Sitemap Generator會提示以下錯誤:
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都會自動更新.
新聞熱點
疑難解答
圖片精選