How to set Noindex to all wordpress pages in a catergory?

As the previous code I posted didnt work for the OP, clutching at straws, we can try to obtain the same outcome using get_the_category As the OP stated he was using YOAST, i’ll wrap this function into the YOAST hook for robots. add_filter(‘wpseo_robots’, ‘yoast_no_home_noindex’, 999); function yoast_no_home_noindex($string= “”) { $term_id = get_the_category( $post->ID ); if($term_id[0]->term_id … Read more

Prevent Indexing of 404 Page

This won’t ever return true: if ( is_single( ‘404.php’ ) ) {} The is_single() conditional only returns true in a single blog post context. The parameter it accepts is a post ID, slug, or title. The 404.php file is a template file, not a post. Use is_404() instead: if ( is_404() ) {}

Removing “Noindex, follow” from pages [closed]

Ooohhh you mean “pagination” pages. Gotcha now! It’s hard to say for sure(I know I know), but at first glance it looks like this block of code would be what you’re after: if ( $wp_query->query_vars[‘paged’] && $wp_query->query_vars[‘paged’] > 1 && isset( $options[‘noindex-subpages’] ) && $options[‘noindex-subpages’] ) { $robots[‘index’] = ‘noindex’; $robots[‘follow’] = ‘follow’; } }