plugin development - How do I change the author of a custom post type?

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 wit

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.

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 edited Jul 23, 2012 at 3:28 fdsa asked Jul 23, 2012 at 3:00 fdsafdsa 1,0651 gold badge7 silver badges19 bronze badges 1
  • which one, you should tick answer which helped – Amit Kosti Commented Aug 4, 2012 at 23:57
Add a comment  | 

3 Answers 3

Reset to default 26

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.

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');

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745347781a4623642.html

相关推荐

  • plugin development - How do I change the author of a custom post type?

    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 wit

    7小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信