Support » Plugin: Google XML Sitemaps » How to include pages with custom query vars in sitemap

  • Hi,

    First, thank you for your magnificent plugin.

    I created a custom query vars to filter posts by date, like this:

    function sm_register_query_vars( $vars ) {
        $vars[] = 'date';
        return $vars;
    add_filter( 'query_vars', 'sm_register_query_vars' );

    then I created a rewrite rule to make this kind of slug seo friendly, like this:

    function add_rewrite_rules($aRules) {
    $aNewRules = array(
    	'^calendar/(.+?)/?' => 'index.php?date=$matches[1]',
    $aRules = $aNewRules + $aRules;
    return $aRules;
    add_filter('rewrite_rules_array', 'add_rewrite_rules');

    And now I have many pages like this that are generated dynamically:


    But as those pages are not a standard content… the plugin “Google XML Sitemaps” can not take them into consideration and cannot include them into sitemap.

    I did include some of them manually as “Additional Pages”, but as there are many of them, I am asking is there a programmatically way to add those kind of pages to sitemap.

    Thank you for your help.

  • The topic ‘How to include pages with custom query vars in sitemap’ is closed to new replies.