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:
- Shared functionality in plugins and themes
- Plugin update error message
- Prevent publishing the post before setting a featured image?
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- How to handel multiple checkbox field in the admin settings page with Settings API
- wp_insert_user – how to send verification email before logging in
- Is the WordPress HTTPS Plugin Still Safe To Use? [closed]
- Set a User as Author of all ‘New Posts’ posted
- Post source link plugin – small modification
- How do you auto-activate plugins from child themes
- How to load plugin before the wordpress jquery?
- What is the function to get plugin base url in multisite?
- Code in theme functions.php faster than with a plugin?
- Override the core function locate_template
- How to redirect Old Post URL to new Post and keep Old post Comments?
- Trying to count the total number of paragraphs inside a blog article
- How to get post URL in the_content filter?
- How to get variables from fucntion.php to my plugin files
- May i Use ShortCode in Template?
- Pass info from functions.php to plugin
- add_query_arg not working
- Inserting HTML tag with ACF into shortcode
- How to stop or remove an action being called inside a function of an extended class
- How to Display a Plugin function (content) on frontpage using index.php
- Theme my Login plugin, how to update fields
- Date calculations from 2 custom fields
- How to debug error message: Cannot modify header information
- How to enable specific plugin only based around shop manager role?
- get current date + 90 days and checking every day
- How to create an input field, and base the output on spreadsheet data? [closed]
- Customize permalink wordpress category id
- Admin style for just one plugin in dashboard
- Redirect to another page using contact form 7? [closed]
- Display Custom Field Value on Admin Page Column
- List the authors that have written posts in a category
- How to get plugin name from plugin file location
- Checking the count within a foreach loop
- Create a post builder skin in a plugin
- Need to replace Currency Shortforms
- add_query_arg not work in admin
- How do I create a custom permalink structure for a page template
- How to remove a class function from a plugin by using remove_action()?
- How to translate wordpress error message
- Api external with wordpress
- Hook for altering the content of all wp mails
- How to get rid of Ellipsis on Woocommerce [Essential] Theme [closed]
- Sharing functions between plugins
- More gentle way to hook WordPress custom url
- 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
- How to convert Currency from USD to other IP Based currency in Php function
- implement custom roles in custom plugin
- How to get current cart values using WC_Shortcodes?
- the_posts_pagination() not working if I add wp_head() to header.php
- How to copy the all WordPress media items to another custom plugin folder?
- FPDF for creating pdf diplomas
- WordPress default post categories meta box widget
- Fatal error “Call to undefined function is_plugin_active” each time the plugin is activated
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- adding dynamic/multiple slug values in ‘option_none_value’
- Make modification of add_to_cart button specific to single page
- front end editor creation for Restropress plug in – displaying information from a WP admin area, on a different URL
- how can export data in excel file custom plugin
- WP_CRON issue with UTC and local time
- How to wrap image tag into div for post only?
- Update User Meta Via Ajax
- Compare Ajax Data Results
- EventON – Dequeue Styles
- 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
- Unexpected plugin_dir_path Output
- Every time I use wp_get_current_user() my plugin breaks
- Can plugin automatically update if i hide the update notification?
- how to repeat taxonomy in different places on wordpress
- how to create table during plugin installation in side a class
- Posting code inside the post instead of in the template file using shortcode
- Saving plugin data returns “You do not have sufficient permissions to access this page.”
- How to use scripts when header/footer are stripped out
- Metabox Data not saving
- Can anyone tell me why I can’t edit a plugin when it is installed without having to re-install?
- Custom Function for SEO by Yoast plugin
- Call current post parameters inside a plugin
- Can’t get custom user meta to show in header
- How to list posts that appear in two categories
- Including a PHP file via a function that is part of a plugin?
- overwrite a plugin function in functions.php
- Pass strings to plugin function [closed]
- How to tweak a plugin without preventing it from updating
- WP Members additional fields on user profile [closed]
- Adminimize Plugin — Is there an alternative to limiting Editor to ‘Appearance > Widgets’ only?
- Integrate Razorpay quick payments plugin with contact form7 plugin
- Woocommerce – Product Description heading [closed]
- Display Video as Post Thumbnail
- Notifications Bar on home page only
- How to disable plugin capability : “create new category”
- Option value not getting updated until page refresh in WordPress
- WordPress Custom Page Blog Template Pagination Problem (Pagination Not Displaying)
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode