Don't Crawl Posts,Categories Using Meta Tags in Wordpress

If we want to google or other search engines do not crawl our posts and categories in wordpress . For this we can use following script,
Go to functions.php file in your theme-:

function add_meta_tags()
{
      if(is_single() || is_archive())
       { ?>
         <meta name="robots" content="noindex,nofollow"/>
       <?php  }
}

add_action('wp_head ','add_meta_tags');

If you want to use other pages like author,tags and date just replace if statement

if(is_author() || is_tag() || is_date())

Thanks.

Comments

Popular posts from this blog

How to show Squarespace gallery in Masonry view

How to check if current post have specific shortcode in Wordpress

How to Create Secondary Menu in Squarespace