Skip Navigation

[Resolved] Assign post categories to specifics user roles

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

Last updated by Waqar 3 months, 3 weeks ago.

Assigned support staff: Waqar.

Screenshot 2023-05-31 alle 16.50.32.jpg

Hi, Related to this my old support ticket ( I need more help...

I have 3 post categories (hidden link - hidden link and hidden link), I need that this archive pages become visible only to specifics (differents) user roles.

Category "comunicazioni-breda" to "administrator,editor,author,commerciale_altri_prodotti,commerciale_libro,commerciale_sezionali".
Category "comunicazioni-bremet" to "administrator,editor,author,commerciale_bremet".
Category "comunicazioni-bremet-pers" to "administrator,editor,author,comm_bremet_pers".

How can I set this scenario, assuming that I like actual grafich content in the archive pages (see attachment, it's a masonry)?

Now I haven't set any WordPress archive for the post categories... Can you help me withe the Conditional code (ad update starting from the one in the OLD support ticket) and to where I have to put it?

Thanks in advance


A little EDIT:
It's possible to make a similar thing withe the TAGS?



Languages: English (English )

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


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

To suggest the best way to achieve this, I'll need to see how these taxonomies and the archive are set up in the admin area.

Can you please share temporary admin login details, in reply to this message?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.




Languages: English (English )

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

Thank you for sharing these details.

If you were using the Toolset's WordPress Archives for these taxonomy archives and the post view for the blog page, you could register a custom shortcode to use in a conditional check for multiple roles.
( example solution: )

But, since you plan to use the active theme's own layout for these pages, you'll need to add changes to the theme files too.

For example, the layout for the archive pages can be found in the file named 'archive.php' in the theme. In that file, you can use the conditional tags ( ref: ) to see if one of the target category term's archive is being viewed and then use the 'wp_get_current_user' function ( ref: ) to see if the current user has one of the roles for which access to these posts should be allowed.

Similarly, the code for the blog page should be available in the file named 'index.php'.

Note: If you see these files in the active child theme's folder, use them for this customization. If these files are not in the child theme's folder, copy them from the parent theme's folder into the child theme's folder and then add customizations to those files.

I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors: