How can I solve the problem of ILLEGAL STRING OFFSET LC_IS_UPDATE_SITEMAP_WHEN_POST in the BAIDU SITEMAP GENERATOR plug-in? This occurs when an article is published. Illegal string offset. For details, refer to PHP5.4 update notes.
The wordpress website map plug-in is now used by Liu Cheng's Baidu Sitemap Generator, which I use now! But sometimes this problem is reported! PHP Warning: Illegal string offset 'lc_is_update_sitemap_when_post 'in ...... /Wp-content/plugins/baidu-sitemap-generator/baidu_sitemap.php on line 406. The solution to this problem is:
Open the 406th lines in the baidu-sitemap.php file:
Run the following code:
If ($ get_baidu_sitemap_options ['lc_is_update_sitemap_when_post '] = '1 & prime ;){
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 ');
}
Comment out the condition statement directly and change it:
// If ($ get_baidu_sitemap_options ['lc_is_update_sitemap_when_post '] = '1 & prime ;){
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 ');
//}
That's all.
The modified code roughly means that every time an article is published, sitemap will be automatically updated.