WordPress Add sitemap.xml a robots.txt dinamicamente

/**
 * Add Yoast SEO sitemap to virtual robots.txt file network wide
 * https://wphelper.site/robots-txt-yoast-sitemap-multisite/
 */
function wphelper_network_robotstxt_function( $output, $public ) {
    $homeURL = get_home_url();
 
    $output .= "Sitemap: $homeURL/sitemap_index.xml\n";
     
    return $output;
}
add_filter( 'robots_txt', 'wphelper_network_robotstxt_function', 20, 2 );
superduperadmin