1,099   PHP WordPress

我用的插件的baidu-sitemap-generator ,查看sitemap,发现还是很久以前的,新建了文章,sitemap依然没自动更新!
查看插件源码文件 baidu_sitemap.php

[weblogic@v0A-123-177-206 baidu-sitemap-generator]$ pwd
/usr/share/system-config-web/html/luckybird/wp-content/plugins/baidu-sitemap-generator
[weblogic@v0A-123-177-206 baidu-sitemap-generator]$ vim baidu_sitemap.php 

function baidu_sitemap_by_post($post_ID) {
// 获取配置内容,没有经过转换,参考之前的函数,利用get_baidu_sitemap_options()来转换即可
//      $get_baidu_sitemap_options = get_option(NEW_BAIDU_SITEMAP_OPTION);
        $get_baidu_sitemap_options = get_baidu_sitemap_options();
        if(isset($get_baidu_sitemap_options['lc_is_update_sitemap_when_post'])){
                if($get_baidu_sitemap_options['lc_is_update_sitemap_when_post'] == '1'){
                          build_baidu_sitemap();
                }
        }

        return $post_ID;
}

按照上述修改,在修改、创建文章时,会自动更新sitemap了




One Response

Leave a Reply

Your email address will not be published. Required fields are marked *