Prohibit search engines from including specific WordPress articles

WordPress five 2.3K Reading mode

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.

 Prohibit search engines from including specific WordPress articles

Google

Open the theme header.php template file and paste the following code into <head> and </head> Between labels:

  1. <? php
  2.      $noindex  = get_post_meta( $post ->ID, 'noindex-post', true);
  3.  
  4.      if  ( $noindex ) {
  5.          echo  '<meta name= "robots"  content= "noindex,nofollow"  />';
  6.     }
  7. ?>

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!

 weinxin
My Wechat
Copyright Notice
Please indicate the source and link of the original article reprinted on this site. Thank you for your cooperation!
five hundred and ninety-eight million eight hundred and forty-five thousand and six
 
 Robin
five hundred and ninety-eight million eight hundred and forty-five thousand and six
Comments five    Visitors four    Author one
    •  average
      average one

      Brother Bird, did I use the pseudo static code? How can I see whether it has taken effect

        •  Robin
          Robin

          @ average The code is only valid for Google, and the domestic search is basically invalid

        •  waw168
          waw168 one

          Uncle Bird, if you can ask me, it's my blog http://www.waw168.com/450.html/7b1e06bb996c3421f472839511c03471 Why is such a page? What should I write if I use robots to prohibit spiders from crawling?

          •  whisper to one another
            whisper to one another one

            Is there a code that does not allow the search engine to include a paragraph of text?

            Do you have an email reply?

            •  [Poria cocos&Angelica dahurica] RAPHAEL LAU
              [Poria cocos&Angelica dahurica] RAPHAEL LAU zero

              Brother Bird, I used the Golden Flower webmaster to check that these navigation bars can't be included. What should I do?

             anonymous

            Comment

            Anonymous netizens
             :?:  :razz:  :sad:  :evil:  :!:  :smile:  :oops:  :grin:  :eek:  :shock:  :???:  :cool:  :lol:  :mad:  :twisted:  :roll:  :wink:  :idea:  :arrow:  :neutral:  :cry:  :mrgreen:

            Drag the slider to complete validation