Skip Navigation

[Resolved] I need to create custom roles for specific Post Type based on taxonomy

This support ticket is created 5 years, 1 month 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 5 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#1218397

Hi, I have created a custom post type with a custom taxonomy. I want to create a new role that can only modify those post types based on a taxonomy.

For ex.:
Custom post type "House"
Custom Taxonomy "Client 1"
Custom Role "Client 1"

I want every user that have the role Client 1 to be able to modify just the post types that have the taxonomy Client 1.

Any idea on how to do that?

Thanks!

#1218930

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Ernesto,

Thank you for contacting us and I'll be happy to assist.

There is no direct way to link custom taxonomy terms and custom user roles, but to achieve this you'll need some custom code.

For example, you can create a custom shortcode ( ref: https://codex.wordpress.org/Shortcode_API ) which gets the current user's role and the current post's attached taxonomy terms and then return true or false, whether they match or not.

That custom shortcode can then be used with Toolset View's conditional blocks, to show/hide the post's content or edit form, accordingly:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.