Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have made a custom post type and need to be able to create posts and assign them to authors. It is easy to do this with posts as you can go to the bulk edit screen and immediately change the author. However, when I try to do this with my custom post type the author box is not there. How do I add the functionality to change the author of my custom post type?

EDIT: I found a solution, see answer below.

share|improve this question
    
which one, you should tick answer which helped –  amit Aug 4 '12 at 23:57
add comment

3 Answers

in Custom Post Type register arguments array use this

'supports' => array('title', 'editor', 'thumbnail', 'comments', 'author'),

This will activate author box on the edit screen. After registering author to cpt you need to activate author from edit screen option ( top of the edit screen where you can enable/disable all metabox ) to display authorbox on the edit screen.

share|improve this answer
add comment
up vote 1 down vote accepted

I found out that the edit author attribute is not added by default in for custom post types. To add the author attribute the following code is required:

function allowAuthorEditing()
{
  add_post_type_support( 'mytype', 'author' );
}

add_action('init','allowAuthorEditing');
share|improve this answer
    
Why don't you just add this when you register your custom post type. –  Brian Fegter Jul 23 '12 at 3:31
    
Will do............. –  fdsa Jul 23 '12 at 4:34
add comment

Go to Screen Options in the top right corner and check the box that says Author. It will then display the Author meta box. This is possibly the worst user experience in WordPress. It confuses so many people.

share|improve this answer
    
It got even weirder...Thanks for the help! –  fdsa Jul 23 '12 at 3:27
    
@fdsa What does that mean? –  Brian Fegter Jul 23 '12 at 3:30
    
Referring to answer below, expected 'author' attribute to be by default. –  fdsa Jul 23 '12 at 4:33
1  
@fdsa Gotcha! You can add that to the capabilities array. –  Brian Fegter Jul 23 '12 at 4:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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