• Resolved Marlimant

    (@marlimant)


    Hi:
    WordPress 5.5 includes its own wp_sitemaps function.
    Do I have to disable it including add_filter( 'wp_sitemaps_enabled', '__return_false' ); in functions.php to this plugin works without duplicate the xml information?

    Thanks.

    • This topic was modified 2 years, 8 months ago by Marlimant.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi, yes you could do that while waiting for the next release of this plugin which will include the filter to disable the internal sitemap 🙂

    Also, if you want to create a redirect for the core sitemap index to this plugin’s sitemap index, you can add this action:

    
    add_action(
    	'template_redirect',
    	function() { 
    		if ( ! empty( $_SERVER['REQUEST_URI'] ) && substr( $_SERVER['REQUEST_URI'], 0, 15) === '/wp-sitemap.xml' ) { 
    			wp_redirect( home_url( 'sitemap.xml' ), 301 ); 
    			exit(); 
    		} 
    	}
    );
    

    PS: And do not forget to visit your Permalinks admin page to flush the old rewrite rules (only a visit to that page is enough).

    Thread Starter Marlimant

    (@marlimant)

    Great idea!
    I will need to delete the redirection too after the next release of this plugin?
    Thank you.

    Thread Starter Marlimant

    (@marlimant)

    I’m using /sitemap-news.xml too. The redirection will work for news sitemaps too?

    No, after the update you will not need to delete the code. You can but you do not have to because it will not break anything. Your news sitemap should be fine too 🙂

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Disable wp_sitemaps function?’ is closed to new replies.