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 == 92) {
$string= "noindex, nofollow";
}
return $string;
}
Same again, just drop this into your themes functions file.
Related Posts:
- Between functions.php (theme), widgets, and plugins, which is loaded first?
- Where do I put the code snippets I found here or somewhere else on the web?
- How do I call wp_get_current_user() in a plugin when plugins are loaded before pluggable.php?
- How to remove WPML Generator Meta Tag by theme’s functions.php (override plugin function)? [closed]
- Define Function in functions.php or plugin and call in theme loop
- Autogenerate wordpress shortcodes using array?
- How to override a theme function (within a class) using a plugin
- WooCommerce create new product and add to cart on form submit
- Change destination author link
- Shortcode under a Shortcode Multiple times Possible?
- How to call a plugin function in footer.php
- How to remove action from plugin?
- Over write plugin templates
- Override plugin functions in functions.php
- Using has_filter with a class based plugin to check whether the plugin is active or not
- How to Replace Words with Hypertext Link But Ignore Previously Existed Links?
- ajax front-end increment views on click
- Display a text message if the field is not found and not if found
- Scope for PHP Variables Assigned in functions.php or a plugin
- Override the filter from plugin in child theme
- Add a plugin before main container
- Get all categories of custom post even not assigned
- Function to prevent users from trashing comments
- How does WordPress process plugin installations?
- How to create TEMPORARY Download links in a wordpress POST?
- Conditionally add apt. Open Graph meta data to different pages on WordPress site
- plugin development: problem with functions
- Dropdown menu on custom page with product to choose number of products per page
- Bootstrap Drop Down menu is not working
- wordpress plugin is not activating from widget
- Custom random quote widget breaks when used in multiple sidebars
- How to change constants in WordPress wp-config.php programmatically?
- How to use a class from another plugin
- Override Plugin Script Fucnction in WordPress
- Conditional attributes and logic per product category
- How to remove custom post type and add category and post name
- Difference and examples of esc_attr__() and esc_attr_e()
- Is there a best practice remediation for PhpStorm’s warning that void function the_post_thumbnail is used?
- How to prevent additional code in functions.php to be removed once there is an update?
- Proper way to use plugin functions in functions.php
- How to reset the plugins without deactivate the plugin
- plugins_url() works everywhere but wp_reqister_script()
- Replacing global wp_query
- How to get specific string/value from an array? php [closed]
- Woocommerce singe product custom gallery output works just on the first slide
- How to translate wordpress error message
- strange shortcode error: does shortcodes requires any dependency?
- All custom widgets are not showing in widget area at the same time
- Execute a function when the entire page is displayed
- More gentle way to hook WordPress custom url
- How to add custom function to pluggable.php
- Removing the custom_image_header from wp_head
- auto activate plugin when theme is active
- Build a must-use plugin that tracks when other plugins are activated or deactivated
- Checkbox show / hide output result
- How to keep plugin (media-sync) running even the tab is closed?
- Load CSS before Theme CSS
- Custom Logo Link WordPress
- Where do I put the code snippets I found here or somewhere else on the web?
- How to convert Currency from USD to other IP Based currency in Php function
- Attempting to list all product categories and the price range of all products within them
- the_posts_pagination() not working if I add wp_head() to header.php
- FPDF for creating pdf diplomas
- Creating an array from form inputs before it is posted to the options database
- function post to trash problem
- adding dynamic/multiple slug values in ‘option_none_value’
- How to assign a specific service to a specific provider based on location
- Conditional Homepage for logged in user
- Search in WordPress
- Is admin section completely customizable in terms of styling?
- Compare Ajax Data Results
- EventON – Dequeue Styles
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- Migrating custom php we wrote from functions.php into a site-specific plugin
- Nested DIV’s across functions in PHP, do not seem to work
- WordPress Add advertising ads befor and after content with periority [closed]
- Function in my plugin is called twice
- Searched & tried a lot: Is it Possible to Eliminate Render Blocking Manually
- Every time I use wp_get_current_user() my plugin breaks
- Can plugin automatically update if i hide the update notification?
- Conditional required fields for WordPress Contact Form 7
- AJAX login without a plugin does not work. when add a action to function.php
- Cannot access variables within a widget
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to use scripts when header/footer are stripped out
- How to add a handler for a button in plugin?
- Custom Function for SEO by Yoast plugin
- Call current post parameters inside a plugin
- How to list posts that appear in two categories
- Building custom pages with a video player
- Move related products after product summary? [closed]
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Woocommerce – Product Description heading [closed]
- Woocommerce disable checkout on specific day
- Sync roles across several plugins
- How to disable plugin capability : “create new category”
- filter just a portion of plugin function
- Option value not getting updated until page refresh in WordPress
- Sort posts by Date (DESC) and by ACF: active_inactive (ASC)
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode