How to noindex automatically all post of a specific category?

My site is auto importing feed of other website. Obviously it's copied content for google. So i want to noindex all posts comes from that feed. Thanks

Topic noindex Wordpress

Category Web


Being excluded-cat and excluded-cat-1 the categories you want to exclude from indexing:

add_action('wp_head','AS_exclude_category_from_indexing');

function AS_exclude_category_from_indexing(){
  $html="";
  if(has_category('excluded-cat') || has_category('excluded-cat-1')){
    $html= "<meta name=\"robots\" content=\"noindex,follow\">".PHP_EOL;
  } 
  echo $html;
}

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.