Hook into the action wp_head
, test if you are on the category archive or a single post with that category, and print the proper meta
element:
add_action( 'wp_head', 'wpse_91073_noindex' );
function wpse_91073_noindex()
{
if ( ( is_singular() && in_category( 'CATEGORY_SLUG' ) )
or is_category( 'CATEGORY_SLUG' )
)
{
print '<meta name="robots" content="noindex">';
}
}
Replace CATEGORY_SLUG
with the real slug of the category (you can find that in wp-admin/edit-tags.php?taxonomy=category
).
Related Posts:
- How to show only homepage in google results instead of privacy, contact pages
- Including categories in search results
- Search Custom Post Type Pages and Custom Fields in 2 Dropdowns?
- Display all search results
- Search posts by post author name
- Search not working with title and content
- How to search only by post title and category?
- Search widget breaks when using multiple loops?
- Pagination not working on custom query
- How can I get all posts data from within a paginated search result?
- Search query – exact post title match
- pagination hook doesn’t work with search results
- Search for posts based on their url in the admin?
- wp_query ‘s’ parameter does not work with custom post type
- Differentiate between posts and pages in search results
- Count search results in heading
- Private Posts/Pages & Search
- Display number of posts via adress bar?
- Tags to Post-ID mysql query. Tag Search
- How to change wordpress dates to native language (even if the languge not available i wordpress)
- How to filter my search in post if contains a word in title, content or excerpt?
- Search results posts_orderby and ID
- Posts and Attachments with “Published” status in Search
- How do I change the core post search algorithm? Where is it found/constructed?
- How to add add more properties to WP_Post object in search results loop
- Total number of posts in query (category/tag/author/search results/main page…)
- See if a post has a specified tag
- Why does WordPress search returns same number of results for every search query?
- Hide parts of the post content after typing it’s name or searching it by category
- search content of pages and list in wp-admin
- How to exclude the word “class” from being matched in search?
- Will multiple category descriptions effect my search engine optimization?
- What would causes search to return incorrect results?
- I want to add another search box on posts page in dashboard
- Showing Posts if non are found
- search form for custom fields
- How to show posts in grid style on search result page?
- Search results with pagination not working
- Redirecting wordpress search query to archive page
- How to search through “post title” and “tags” using WP_Query?
- How to create custom search form function including post “tags”
- Remove pagination if search returns empty
- How do i search post by jquery datepicker?
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- show only one category and filter by tag
- On WordPress Search, how to search post from Author meta also
- How to hide meta from search result only on pages?
- Find post tags words in post content and link them to tag URLs
- Custom author search
- WordPress URL question
- WordPress search for specific Post Type
- Display result of custom form
- Customize search results to include custom posts and display in a specific template page
- How can i retrive the movies, trailers, news in a single page using search
- Custom Post Title as search term
- Related posts by searching post tags of single post as terms
- How to get only post=’product’
- Search doesn’t display posts with images
- Is update_post_meta used when save_post action hook is invoked?
- Post title not displaying as recorded in the wp_posts table
- Include Recent Post in Category
- Filtering private Posts
- Reuse old post ID for new post after deleting post
- How to view a post from the wordpress admin screen
- Contact Form 7 Shortcode not recognized inside another shortcode
- Display image gallery if more than 1 image
- Update all posts – 25 000 posts in total
- Display Post from Custom Post Type with Shortcode
- Count words for each author separately
- How to Create another Page Category like the “Post” and “Pages”
- Current post categories and subcatecories outside of the loop
- Post not using taxonomy template
- How do I remove all links from all my posts at once?
- Export post another site
- How do you change the permalink for posts for a single category?
- Create a tree with categories with get_posts()
- allow user to create a draft post but not publish wordpress
- Set featured image as hero image on each page
- Pagination Not Working With Custom Post Type Category
- wp_insert_post() Add and specific ID to the body of that
- Query prints posts without specific categories
- Use posts from old db by changing prefix
- Css and function issue on author archive page
- out of nowhere
- Ignore posts content in the posts queries for internal linking
- Recent Post Issue
- My posts are getting to Auto draft when I try to Publish
- Moving Gutenberg content from one website to another (block media ids wrong?)
- Private post caught in endless redirect loop
- Foreach issue in get_posts function
- How do I fix broken links to images in imported posts’ post_content?
- Blog open in new Tab
- Contributor edits published post and sends for review – post is made private?
- Posts order in grid
- Why does my “Add New Post” page have an old post in it?
- link to edit a post has empty target
- Add CSS and JS files of the template post on a WordPress page
- Pagination Stops
- How to mark only one post as Featured post?
- WordPress: Develop multiple posts with different data