Support Forum
Support › MB Custom Post Type › Custom Post Type: Can’t Assign Author for Role
👋 Hi,
I have a new project with three plugins installed: Meta Box, Meta Box AIO, and Members.
1. With Meta Box, I created a custom post type called Business.
2. As the post’s “Capability type,” I selected “Custom.”
3. In the Members plugin, I assigned all Business post type capabilities to the Administrator role.
4. I create a Role called Business Manager.
5. I assigned Business post type capabilities to the Business Manager, plus the default Read role.
I’m having the following issue. As an administrator, I can create new Business posts, but I cannot change the author of a Business to be a user that is a Business Manager. I can make the post’s author be any of the default WordPress post types, but not a Business Manager.
I’ve read both Meta Box and Members documentation. I additionally tried abandoning the Members Plugin and using the User Role Editor plugin instead. The result was the same, which make me think the issue is not caused by MemberPress. I’m on the latest version of Meta Box, AOI, and WordPress 6.2.2. Thanks for your help!
Hello,
I'm not sure what's wrong with the capabilities of the custom role. I also see that issue on my end. I fix it by coping a default role:
- Assign the capabilities to the Contributor role (default of WordPress)
- Create a custom role and make it a copy of Contributor role.
Then I can assign the posts of CPT to a user who has the custom role.
Hi Peter,
Thanks for your help! I gave this a try. Regrettably, it didn't quite work. I could select the user as author when using the Contributor role directly, but the clone role failed when assigning to a user with the custom role. Also, it's possible that I'll need to change role permissions in the future, so that could leave me stuck.
Is this able to be converted to a bug? Thanks again.
:: Bret
Hello,
I don't think it is a bug of Meta Box. If you create a CPT with the WordPress function register_post_type()
and add the code to enable capabilities as MB CPT plugin does
'capability_type' => ['business', 'business'],
'map_meta_cap' => true,
Then you still cannot assign the CPT to a user who has a custom role.
Refer to the documentation
https://docs.metabox.io/extensions/mb-custom-post-type/#notes
https://developer.wordpress.org/reference/functions/register_post_type/#capabilities
Hi Peter,
I'm grateful for your reply. I read the linked documents. I didn't see that I would not be able to attribute a post's author to a custom role. It's possible that I'm misunderstanding though.
I ran an experiment with the default contributor role, where I added the Business Manager role, for the person to hold two roles. I still could not assign the person as author. In this instance, adding the Business Manager role to a Contributor proved subtractive in permissions, even though the capabilities prescribed the addition of permissions.
Hello,
What I'm trying to do here is to use the WordPress function to register the post type with code, this is what Meta Box CPT does in the background.
So I think it is not an issue of Meta Box CPT and the custom role. You can try to create a topic in the WordPress support forum and ask for help with this issue.
https://wordpress.org/support/forum/how-to-and-troubleshooting/
I hope that makes sense.
Hi Peter,
Thanks for all of your help with this. I'll post to the WordPress forum. At the same time — and I'm not disputing what you've told me 😀 — this seems an odd way for WordPress to manage capabilities. It obviates their usefulness.