• Resolved l575

    (@l575)


    Hello,

    How to remove “User-agent: *Disallow: /wp-content/uploads/sites/2/wpo-plugins-tables-list.json” from robots.txt?

    I get errors from SEO.

    I have a multi-site with super-admin, and adding this:
    add_filter( ‘wpo_update_plugin_json’, ‘__return_false’ ); to the theme functions.php doesn’t help.

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Support vupdraft

    (@vupdraft)

    Can you add the following to your functions.php;

    add_action(‘after_setup_theme’, ‘ab123_remove_robots_txt_entry’);
    function ab123_remove_robots_txt_entry() {
        if (function_exists(‘WP_Optimize’)) {    
            remove_filter(‘robots_txt’, array(WP_Optimize(), ‘robots_txt’), 99, 1);
        }
    }

    Thread Starter l575

    (@l575)

    I have 2 functions.php on the site:

    1-st is in folder “wp-includes”. Adding this code to this folder gives critical error.

    2-nd functions.php is in a theme folder. Adding this code there gives nothing.

    Please advise.

    Plugin Contributor Venkat Raj

    (@webulous)

    @l575 You need to add this to active (storefront) theme’s functions.php file. Remove code from wp-includes functions.php file.

    Please note that If you copy/pasted the code provided, it may have backticks instead of single quote.

    add_action('after_setup_theme', 'ab123_remove_robots_txt_entry');
    function ab123_remove_robots_txt_entry() {
    	if (function_exists('WP_Optimize')) {	
    		remove_filter('robots_txt', array(WP_Optimize(), 'robots_txt'), 99, 1);
    	}
    }

    If the problem persist, please provide screenshot of the code you added.

    Thread Starter l575

    (@l575)

    Hello,

    After adding this code to the theme functions.php file the problem is still persist.

    Please find attached a screenshot.

    https://dropmefiles.com/WDrT2

    Thread Starter l575

    (@l575)

    I use a child theme of storefront. Maybe I should add it to the child theme instead of main one?

    Plugin Support vupdraft

    (@vupdraft)

    Yes, add it to the child theme

    Thread Starter l575

    (@l575)

    I added to the child theme. It didn’t help.

    Plugin Contributor Venkat Raj

    (@webulous)

    @l575 First delete the existing robots.txt file and try again.

    By defult, WP-Optimize doesn’t create a robots.txt file. When an SEO plugin (or other plugins) create a robots.txt file, the provided code will prevent WP-Optimize from adding those line to robots.txt file

    Thread Starter l575

    (@l575)

    I added code to the child theme first.

    Then, I deactivated SEO plugin, so robots file was deleted (it’s in cloud of SEO plugin).

    Then I deactivated WP-optimize plugin.

    After I activated SEO plugin, new robots file was created by it. It was fine.

    After I activated WP-optimize. The line User-agent: *Disallow: /wp-content/uploads/sites/2/wpo-plugins-tables-list.json appeared.

    Please help.

    Thread Starter l575

    (@l575)

    Solution didn’t help, and now I’ve got lots of errors:

    PHP Warning: Use of undefined constant ‘ab123_remove_robots_txt_entry’ – assumed ‘‘ab123_remove_robots_txt_entry’’ (this will throw an Error in a future version of PHP) in /home/………/public_html/wp-content/themes/boutique/functions.php on line 33

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘User-agent: *Disallow: /wp-content/uploads/sites/2/wpo-plugins-tables-list.json’ is closed to new replies.