I would like to set up a Custom Post Type which supports the author feature only for admins.
Other user roles may as well create, see and edit their own posts, but the admins should be able to switch a post's author.
So far I managed to display only their own posts to non-admins thanks to the pre_get_posts filter.
And this is how I define the CPT. What can I do now to restrict the supports author only to admin users?
// CPT
function prefix_setup_cpt(){
register_post_type('whatever',
array(
'labels' => array(
'name' => 'Whatever',
'singular_name' => 'Whatever'
),
'supports' => array(
'title',
'editor',
'author' // <--- This enables author feature
)
....
I am not seeking for a coded answer to copy/paste, but for hints about hooks and other WordPress facts that help me achieve the desired functionality.
Thanks a lot for your attention.
"author"
, but only when the user has the admin role?