What should write for display_name? I want to display author name in custom post types, but I got administrater name ‘root’ for get_the_author() function and when I used get_the_auther_meta(), I couldn’t get anything. If anyone knows please let me know.

enter image description here

1 Answer 1


What I did wrong is, I forget to get author box, hence the_author function was not working, so I add this code in functions.php file

    add_post_type_support( 'my_post_type', array(
    'author', 'excerpt',
    ) );

then I got author box and in author box, set author name and add this code in custom post file



    echo get_the_author_meta('display_name');

Your Answer

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

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