In most cases, we want Google to include articles as soon as possible. But if you want to prohibit search engines from including specific WordPress articles, you can use the method described in this article.
By adding custom columns, prevent Google and other search engines from including specific articles and pages.
Google
Open the theme header.php template file and paste the following code into <head> and </head> Between labels:
- <? php
- $noindex = get_post_meta( $post ->ID, 'noindex-post', true);
-
- if ( $noindex ) {
- echo '<meta name= "robots" content= "noindex,nofollow" />';
- }
- ?>
Whenever you want to prohibit the search engine from including specific articles and pages, just add a custom column name: noindex post, value: optional, and your articles will not be included.
Most of the articles on this site are original and used for personal learning records, which may be helpful to you, for reference only!