• Resolved amot99

    (@amot99)


    Hi,

    until the v4.1.13 the additional url, that i added using the code below, works fine. It added the url to the sitemap index (it was like this https://mysite.test/api/sitemap-places.xml) and inside of it the list of other urls added with add_url. Now, from v4.1.14 to v4.1.20 using the same code below, it adds the url as https://mysite.test/api/places.xml and once opened i get 404 not found. I saw your documentation and i also tried to use the add_filter(‘sm_sitemap_index’ ,….) but nothing changed.

    Ty

    function addToIndex($sitemapGenerator){
    ? ? $sitemapGenerator->add_sitemap("places", null, current_time( 'timestamp'));
    }
    function addToPlaces($sitemapGenerator, $type){

    ? ? if($type <> 'places'){
    ? ? ? ? return;

    ? ? }

    ? ? $sitemapGenerator->add_url(
    ...

    ? ? );

    }
    add_action('sm_build_index', 'addToIndex', 1, 1);
    add_action('sm_build_content', 'addBpmBranchesToSitemap', 1, 2);

Viewing 1 replies (of 1 total)
  • Thread Starter amot99

    (@amot99)

    Hello, maybe i’ve found the solution: i noticed that the rewrite rules have been blocking my custom url, so i used the filter showed below to add my url to the rewrite rules

    add_filter( 'rewrite_rules_array', 'addPlacesToRewriteRules', 1, 1 );
    function addPlacesToRewriteRules( $wp_rules ) {
        $sm_rules        = array(
    ? ? ? ? 'places\.xml$' => 'index.php?xml_sitemap=params=places',
            );
            return array_merge( $sm_rules, $wp_rules );
        }
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.