首页 > CMS > Wordpress > 正文

wordpress发布文章时百度地图出错

2024-09-07 00:51:11
字体:
来源:转载
供稿:网友

最近遇到一个问题,在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 行的以下代码:

  1. if($get_baidu_sitemap_options[' lc_is_update_sitemap_when_post '] == ’1′){ 
  2. wp_clear_scheduled_hook(‘do_baidu_sitemap_by_post’); 
  3. wp_clear_scheduled_hook(‘do_this_auto_daily’); 
  4. wp_schedule_single_event(time()+10, ‘do_baidu_sitemap_by_post’); 

2、把这段代码注释掉,注释后的代码如下:

  1. //if($get_baidu_sitemap_options[' lc_is_update_sitemap_when_post '] == ’1′){ 
  2. wp_clear_scheduled_hook(‘do_baidu_sitemap_by_post’); 
  3. wp_clear_scheduled_hook(‘do_this_auto_daily’); 
  4. wp_schedule_single_event(time()+10, ‘do_baidu_sitemap_by_post’); 
  5. //}  

3、修改bug的思路:每当发布文章时,sitemap都会自动更新.

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表