How can I prevent any of the custom posts from being indexed by search engines?
I see the "Exclude from search" option under Advanced but it's not too clear as to whether it's referring to a front end search within your site or indexing by search engines.
If this is the right setting, how would I apply it when the post type is being created with code?
There are some ways to prevent indexing the CPT
- Uncheck the option Publicly queryable under Exclude from search
- Use the plugin Yoast SEO
- PHP code to show the tag <meta name="robots" content="noindex, follow">