Hide pages from google and visitors

Add a simple checkbox to the post editor to toggle the generation of a meta field that disallows search engines to index your content. Then hook into wp_head, check for the setting and print that field. Sample code for a plugin: add_action( ‘post_submitbox_misc_actions’, ‘show_noindex_checkbox’ ); add_action( ‘save_post’, ‘save_noindex’, 10, 2 ); add_action( ‘wp_head’, ‘insert_noindex_meta’ ); … Read more

Google saying is blocked by robots.txt without robots.txt on my website

Despite the fact your site lacks a robots.txt file, it might be worth making one to allow for Googlebot and other bots to crawl your website. Please use this example: User-agent: * Allow: / Disallow: /wp-content Note: Please remove or amend the /wp-content disallow on the robots.txt, if for whatever reason, you’d like your images … Read more

Why does Google Webmaster Tools say my whole site is blocked by robots.txt when I have no robots.txt?

Similar problem occurred to me, and I got the solution following these: Step 1: Take a backup of your .htaccess file and then remove it (Don’t worry, on next refresh WordPress will create one for you) Step 2: If there’s no robots.txt exists, create one with blank page Step 3: Resubmit the sitemap to google … Read more

Generating robots.txt dynamically

I just tested the ‘robots_txt’ filter on a single installation to modify the output of the virtual /robots.txt that WordPress displays and it worked fine for me: add_filter(‘robots_txt’, ‘wpse_248124_robots_txt’, 10, 2); function wpse_248124_robots_txt($output, $public) { return ‘YOUR DESIRED OUTPUT’; } What is really happening when you try to reach /robots.txt? Does it display the default … Read more

Create unique robots.txt for every site on multisite-installation

Straight from the source, (line 1845 wp-includes/functions.php, 3.3.1): function do_robots() { header( ‘Content-Type: text/plain; charset=utf-8’ ); do_action( ‘do_robotstxt’ ); $output = “User-agent: *\n”; $public = get_option( ‘blog_public’ ); if ( ‘0’ == $public ) { $output .= “Disallow: /\n”; } else { $site_url = parse_url( site_url() ); $path = ( !empty( $site_url[‘path’] ) ) ? … Read more