Skip Navigation

[Resolved] Cannot change the author for custom post

This support ticket is created 3 years 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.

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 7 replies, has 2 voices.

Last updated by Minesh 3 years ago.

Assisted by: Minesh.

Author
Posts
#2283539
Screenshot 2022-02-04 at 6.03.24 PM.png
Screenshot 2022-02-04 at 5.46.12 PM.png
Screenshot 2022-02-04 at 5.45.51 PM.png

Dear Sir/Madam,

I have a custom post "member" and also a custom role "member", I did enable it from post type but I don't see the member author list from author dropdown even I login as administrator role in Incognito windows.

I add below script in functions.php

function wpdocs_add_members_to_dropdown( $query_args, $r ) {
    $query_args['role__in'] = array('member');
    unset( $query_args['who'] );
    return $query_args;
}
add_filter( 'wp_dropdown_users_args', 'wpdocs_add_members_to_dropdown', 10, 2 );

Please advise how I can let editor role to change the author?

#2283607

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Can you please share on what post type you want to display the author belongs to member role and send me admin access details as well as tell me where you added the code you shared.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2284269
Screenshot 2022-02-05 at 2.44.17 PM.png
Screenshot 2022-02-05 at 2.43.50 PM.png
Screenshot 2022-02-05 at 3.04.50 PM.png

Dear Minesh,

I did some research to the author list and finally find below finding
I put below script to functions.php

// Handles the Gutenberg document editor authors dropdown
function display_custom_roles_in_gutenberg_author_dropdown($prepared_args, $request = null)
{
	if (isset($prepared_args['who']) && $prepared_args['who'] === 'authors') {
		unset($prepared_args['who']);
		$prepared_args['role__in'] = ['administrator', 'author', 'editor', 'member'];
	}
    return $prepared_args;
}
add_filter('rest_user_query', 'display_custom_roles_in_gutenberg_author_dropdown', 10, 2);

I can change the author to the custom post 'member' using Block editor mode but not classic mode. Refer to screenshot, demomember is the user in member role.

I put below script to functions.php

// Handles the Quick Edit authors dropdown
function display_custom_roles_in_author_dropdown($query_args, $r)
{
	if (isset($r['name']) && ($r['name'] === 'post_author_override' || $r['name'] === 'post_author')) {
		if (isset($query_args['who'])) {
			unset($query_args['who']);
        }
        $query_args['role__in'] = ['administrator', 'author', 'editor'];
    }
    return $query_args;
}
add_filter('wp_dropdown_users_args', 'display_custom_roles_in_author_dropdown', 10, 2);

It works to standard WP posts but not Toolset custom post, I attached both Toolset post and WP posts for your reference.

#2285535

Minesh
Supporter

Languages: English (English )

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

Do you mean that the you would like to mention the issue that Author dropdown is not displayed with Quick Edit screen on Member Post type?

#2285551
Screenshot 2022-02-07 at 5.05.57 PM.png
Screenshot 2022-02-07 at 5.04.57 PM.png
Screenshot 2022-02-07 at 5.04.27 PM.png

Dear Minesh,

I assume Author dropdown should be the same to all classic editor, block editor and Quick Edit.

I attached all screenshots for your reference.

Block Editor mode - normal display the author dropdown
Classic Editor mode - author section exist but no dropdown
Quick Edit - author dropdown is missed

#2285795

Minesh
Supporter

Languages: English (English )

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

This is a known issue to us and we publish the errata page:
- https://toolset.com/errata/cannot-set-post-author-when-post-type-managed-by-access/

Our Devs working on it in order to offer a hot-fix, please hold on for further updates.

#2287605

Dear Minesh,

thanks for your update, by the way, is it possible to let me change all post using block editor? I want my users no need to change by himself.

#2287627

Minesh
Supporter

Languages: English (English )

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

You can navigate to:
=> Toolset => Post Types => Edit your desired post type => set the "Editor" option to " Block" and save the post type.