I am trying to add the current post's author as the content for the meta author tag. I wrapped this particular meta in an is_single condition and then tried:

<meta name="author" content="<?php get_the_author(); ?>" />

as well as tried this:

<meta name="author" content="<?php the_author(); ?>" />

For both the above, Facebook debugger responded with:

Meta with name instead of property : The meta tag on the page was specified with name 'author', which matches a configured property of this object type. It will be ignored unless specified with the meta property attribute instead of the meta name attribute.

Then I tried:

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

as well as tried this:

<meta property="article:author" content="<?php get_the_author(); ?>" />

For both the above, Facebook debugger responded with:

Parser Mismatched Metadata : The parser's result for this metadata did not match the input metadata. Likely, this was caused by the data being ordered in an unexpected way, multiple values being given for a property only expecting a single value, or property values for a given property being mismatched. Here are the input properties that were not seen in the parsed result: 'article:author'.

What am I doing wrong as all of the above four metas just return a blank content (<meta name="author" content/>) for the author tag.

  • Is your code inside the Loop?
    – coopersita
    Commented Sep 26, 2015 at 19:02
  • @coopersita The meta tag? It's in the <head>....</head> section so I think it's not within the loop.
    – AndrewL64
    Commented Sep 26, 2015 at 19:19
  • According to the documentation, the_author must be in the loop.
    – coopersita
    Commented Sep 26, 2015 at 19:24
  • But how can I include a <meta> tag in the body section?
    – AndrewL64
    Commented Sep 26, 2015 at 19:47

3 Answers 3


You cad add it via functions.php with a hook, instead of inside the loop (you don't really want to add a loop to header.php):

function add_author_meta() {

    if (is_single()){
        global $post;
        $author = get_the_author_meta('user_nicename', $post->post_author);
        echo "<meta name=\"author\" content=\"$author\">";
add_action( 'wp_enqueue_scripts', 'add_author_meta' );
  • I added the above to my functions.php file but the meta tag is not being echoed unfortunately :(
    – AndrewL64
    Commented Sep 27, 2015 at 7:06
  • It will only work on single pages. Does your theme have wp_head() in header.php?
    – coopersita
    Commented Sep 27, 2015 at 15:08

Add this into header.php

<meta name="author" content="<?php the_author_meta('user_nicename', $post->post_author); ?>">

You can add meta tags using wp_head hook action from functions.php of the Themes files or create a custom plugin.

Here you can check example.

add_action('wp_head', 'fc_opengraph');

function fc_opengraph() {

  if ( is_single() || is_page() ) {

    $post_id = get_queried_object_id(); // get current post id

    $author_name = 'set your author name';

    $site_name = get_bloginfo('name');

    $description = wp_trim_words( get_post_field('post_content', $post_id), 25 );

    $image = get_the_post_thumbnail_url($post_id);

    if( !empty( get_post_meta($post_id, 'og_image', true) ) ) $image = get_post_meta($post_id, 'og_image', true);

    $locale = get_locale();

    echo '<meta property="og:locale" content="' . esc_attr($locale) . '" />';
    echo '<meta property="og:type" content="article" />';
    echo '<meta property="author" content="' . esc_attr($author_name) . '" />';
    echo '<meta property="og:description" content="' . esc_attr($description) . '" />';
    echo '<meta property="og:url" content="' . esc_url($url) . '" />';
    echo '<meta property="og:site_name" content="' . esc_attr($site_name) . '" />';

    if($image) echo '<meta property="og:image" content="' . esc_url($image) . '" />';



Please check this url for the hook documentation: https://developer.wordpress.org/reference/hooks/wp_head/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.