• Resolved Max

    (@makspostal)


    Hi,

    How can I turn OFF Tools - File Editor feature in YOAST SEO?

    I’m using WordPress in multisite mode and plugin Robots.txt Editor in order to manage each site’s robots.txt.
    But this YOAST SEO feature adds code block:

    
    # START YOAST BLOCK
    # ---------------------------
    User-agent: *
    Disallow:
    
    Sitemap: http://en.wpwc.ru/sitemap_index.xml
    # ---------------------------
    # END YOAST BLOCK
    

    in my robots.txt files, so they become broken for robots.txt validator.

Viewing 6 replies - 16 through 21 (of 21 total)
  • Please check here for the help. May be i t can resolve your issue.

    Apalion

    Hello, I need help because in reality, this function prevents the totally ridiculous site from being indexed

    START YOAST BLOCK —————————

    User-agent: *
    Disallow:

    Sitemap: https://————————— END YOAST BLOCK

    It’s incredible, this function actually blocks indexing on Google. Basically we make articles and it’s impossible to index them, it’s still very ridiculous in reality.

    How to remove this function how to deactivate this so that we can index on the search engine ???????????

    Hello, I need help because in reality, this function prevents the totally ridiculous site from being indexed

    START YOAST BLOCK —————————

    User-agent: *
    Disallow:

    Sitemap: https://————————— END YOAST BLOCK

    It’s incredible, this function actually blocks indexing on Google. Basically we make articles and it’s impossible to index them, it’s still very ridiculous in reality.

    How to remove this function how to deactivate this so that we can index on the search engine ???????????

    Thread Starter Max

    (@makspostal)

    Hello @mouss1333

    Just use this snippet in your functions.php:

    /**
     * Fix Yoast SEO robots.txt changes.
     * https://wordpress.org/support/topic/disable-robots-txt-changing-by-yoast-seo/#post-16648736
     */
    function wpwc_fix_yoast_seo_robots_txt() {
    
    	global $wp_filter;
    
    	if ( isset( $wp_filter['robots_txt']->callbacks ) && is_array( $wp_filter['robots_txt']->callbacks ) ) {
    
    		foreach ( $wp_filter['robots_txt']->callbacks as $callback_priority => $callback ) {
    			foreach ( $callback as $function_key => $function ) {
    
    				if ( 'filter_robots' === $function['function'][1] ) {
    					unset( $wp_filter['robots_txt']->callbacks[ $callback_priority ][ $function_key ] );
    				}
    			}
    		}
    	}
    }
    
    add_action( 'wp_loaded', 'wpwc_fix_yoast_seo_robots_txt' );
Viewing 6 replies - 16 through 21 (of 21 total)
  • The topic ‘Disable robots.txt changing by YOAST SEO’ is closed to new replies.