WordPress adds the author's name in the meta tag

WordPress one seven hundred and forty-four Reading mode

 WordPress adds the author's name in the meta tag

WordPress adds the author's name in the meta tag

Adding a WordPress theme on meta property When labeling, one of them is:

 <meta property="og: author" content="author"/>

One question, the common WordPress codes on the Internet are:

 <meta property="og:author" content="<?php the_author(); ?> " />

Including:

 <? php the_author(); ?>

In this case, the author name cannot be displayed. If you don't know how to display the author name, it may be copied without knowing why.

Solution:

 <? php the_author_meta('user_nicename', $post->post_author); ?>

Replace.

The default user_nicename is the login name of the author, which is dangerous to expose important information. It can be replaced with the following:

  • Display_name Public display name
  • User_nicename nickname
  • First_name First Name
  • Last_name Last Name

It is recommended to use: display_name, which is the name in the "Public Display" setting.

As for the complete meta property The way to write tags is different because of different topics and different ways to obtain information. I will not write them here. I will search a lot on the Internet. If the author's name is not displayed, please change it.

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
    •  All
      All four

      The_author() can only be used in the main loop, not in the header.

     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