Display Post Author for Custom Post Type in Edit-Post Screen

I’ve built a marketplace-type site that lets different users post custom listings to the site.

I want to use the WP backend to administer these listings with my admin account. The custom post types are displayed much like normal posts there.

The problem is that the post author isn’t shown. I googled the issue and quickly found that adding "supports" => array( "title", "editor", "author" ) to the $args for register_post_type() adds a column showing the author to the listings of all custom post items.

However, I’m unsure how to add a box displaying the author in the edit screen where the editor and other detailed information about the post shows. As is I just have the box with the publishing information and one for the custom post type’s taxonomies.

How would I go about having the post’s author displayed there too? I’m really a bit lost on this and couldn’t find anything on google.

2 Answers
2

You can achieve this by using the add_post_type_support function as described here: https://codex.wordpress.org/Function_Reference/add_post_type_support.

This code should work:

function add_author_support_to_posts() {
   add_post_type_support( 'your_custom_post_type', 'author' ); 
}
add_action( 'init', 'add_author_support_to_posts' );

It can be added in your theme’s function.php file.

Leave a Comment