Replies: 1
How can we change the links generated by the Yoast plugin. Our CMS is hosted in a subdirectory and therefore when the sitemap is generated the links all have the subdirectory in the URL.
Furthermore to this we are using WP purely has a headless CMS with a VueJS/Nuxt frontend. One ‘work-around’ would be to edit the “class-sitemaps-router.php’ file and change the home_url for when the sitemap is generated. However, we don’t want to have to edit this file as when we update the plugin our changes will get over-written:
public static function get_base_url( $page ) {
global $wp_rewrite;
$base = $wp_rewrite->using_index_permalinks() ? 'index.php/' : '/';
/**
* Filter the base URL of the sitemaps.
*
* @param string $base The string that should be added to home_url() to make the full base URL.
*/
$base = apply_filters( 'wpseo_sitemaps_base_url', $base );
/*
* Get the scheme from the configured home URL instead of letting WordPress
* determine the scheme based on the requested URI.
*/
return home_url( $base . $page, wp_parse_url( get_option( 'home' ), PHP_URL_SCHEME ) );
}
Any help would be much appreciated.