Skip Navigation

[Resolved] Author dropdown only shows users with admin role

This support ticket is created 2 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 5 replies, has 2 voices.

Last updated by chuckH 2 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#2418629

I am trying to:
I am trying to change author for People custom post type. After using the multiple roles per user feature to add additional roles per user, I can only change the post author to the user who created the post or other users assigned administrator role.

Link to a page where the issue can be seen:
link removed

I expected to see:
I expected to see a list of all users in author dropdown list.

Instead, I got:
Instead, I got only the list of users in author dropdown list who have administrator privileges.

To recreate the issue, please log in, visit People custom post type. Select any user and attempt to change author.

I had the same issue back in October 2021. See https://toolset.com/forums/topic/multiple-roles-per-user-unable-to-change-post-author/

I checked my functions.php to ensure the code snippet from the previous fix was still installed:
add_filter('wp_dropdown_users_args', 'assign_any_users_author_box_func', 10, 2);
function assign_any_users_author_box_func($query_args, $r){
$query_arg['who'] = 'any';
return $query_arg;
}

Thank you for your help.

#2419581

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Could you please try to use the following code instead of what you are using currently:

function func_author_dropdown_user_args( $query_args ) {
  
    // Use this array to specify multiple roles to show in dropdown
    $query_args['role__in'] = array('contributor','author', 'subscriber', 'administrator' );
  
    // Unset the 'who' as this defaults to the 'author' role
    unset( $query_args['who'] );
   
    return $query_args;
}
add_filter( 'wp_dropdown_users_args', 'func_author_dropdown_user_args' );

Where:
- You can add any role name slug to the "role__in" argument.

#2420007

Hello. I added the code you provided to functions.php for my theme. Nothing changed.

#2420323

Further testing shows that when I change the People custom post type from "Managed by Access" to "Use the default WordPress read permissions" the author dropdown list populates as it should, with all active users.

#2420453

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I removed the code you added from the theme's functions.php file:

add_filter('wp_dropdown_users_args', 'assign_any_users_author_box_func', 10, 2);
function assign_any_users_author_box_func($query_args, $r){
    $query_arg['who'] = 'any';
    return $query_arg;
}

Can you please tell me where you added the code I shared. Also, it seems as you using WP Engine there is cache issue can you disable the cache until we address this issue.

Also I check the author dropdown showing number of users now, Can you please check if its working as expected.

#2421257

Hi Minesh, the issue appears to be resolved. The author dropdown list is populated with the complete set of authors. Thank you.