Can We Add URL's To Sitemap?

  • Are we able to add url’s to the Sitemap? is so how and where? Thanks

Viewing 1 replies (of 1 total)
  • Hello,

    Thank you for contacting Rank Math today.

    Yes this is possible with some PHP code. You can make use of the following filter on your theme’s functions.php file to add extra URLs:

    /**
     * Filter to add extra URLs to the XML sitemap by type.
     *
     * Only runs for the first page, not on all.
     *
     * @param string $content String content to add, defaults to empty.
     */
    add_action( 'rank_math/sitemap/{$type}_content', function() {
      
    });
    function rank_math_add_custom_dynamic_url( $urls ) {
        $urls .= '
            http://www.mysite.com/dynamic-category1/
            2019-02-22T18:02:24+00:00
        ';
    
        $urls .= '
            http://www.mysite.com/dynamic-category2/
            2019-02-22T18:02:24+00:00
        ';
    
        return $urls;
    }

    Looking forward to helping you. Thank you.

    ​​​​​​

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 1 replies (of 1 total)

The ticket ‘Can We Add URL's To Sitemap?’ is closed to new replies.