Custom Post Type : How to Change Author (4 posts)

  1. Acts7
    Posted 5 years ago #

    I have spent hours scoring the search engines including the search on here.
    But I can find no way to change the author for custom post types.

    Why you might ask? Because I want to pull custom author meta data from the user's profile on the custom post.
    I have ten users (of course each has different facebook and twitter accounts)
    And I want to display those for the sidebar on all custom posts each user writes.

    I initially created all of the posts. But now I can't find a way to make each person the author of their own custom post under custom post type

    For normal posts, its simple - you have the box to edit it.

    SO is there script I could add to my functions.php which would turn on the author assignment? Or is there a simpler solution?

  2. Big Bagel
    Posted 5 years ago #

    You can designate an author in custom post types just like normal posts. If you're not seeing the meta box with the option, open "Screen Options" (top right) and make sure the Author box is set to display.

  3. Acts7
    Posted 5 years ago #


    Thats whats odd. I just double checked. See my screencap.
    Nothing available for authors. Same thing when viewing all posts in the custom post section.
    And when editing a single post in custom post.
    Do I need to do something in the code when setting up the custom post, to enable it? I have not disabled it.
    Its available on regular posts.

  4. Big Bagel
    Posted 5 years ago #

    Sorry, I didn't realize register_post_type() didn't have all those things enabled by default. You can use add_post_type_support() or set the supports argument when you call register_post_type().

    For example, if you want to use the first function, something like this should work:

    <?php add_post_type_support( 'my_post_type', 'author' ) ?>

    Edit (that's what I get for not properly reading the codex):
    You should do as the codex page says and hook that up to 'init'.

Topic Closed

This topic has been closed to new replies.

About this Topic