How to make an author archive only for certain user role and show related CPT

Scenario I made a CPT where I’m taking the stakeholder’s ID as a custom field. All the stakeholders are actually a WordPress’ Registered User with a different role stakeholders – because at some point I need them to login to post their own content. So what actually I’m doing, I’m grabbing the userID and passing … Read more

How can I allow user to select minimum privilege smartly

We can easily asses a user’s role using current_user_can(), but it doesn’t support an array of user roles but a single role. So we have to check each of the role multiple times: if( current_user_can(‘administrator’) || current_user_can(‘editor’) ) { //do this } I’m making a WordPress Plugin, I need the administrator should choose the minimum … Read more

Allow role to edit users at lower level with only specific metadata

How to allow a custom role, company-administrator, to be able to edit/create/delete users lower than their level, subscriber, where some metadata is matched? To elaborate: I’m making a membership site and would like to have a user role which can administer users for their company/organisation only. So, I was thinking to create an email domain … Read more

Add custom capabilities to existing custom post type

The only way I can find to associate post types with custom capabilities is during the register_post_type function. I’m looking to add a capability for a certain role (my_role) for a post type that already exists (my_post_type). I’m looking to allow front-end users to view my_post_types only as well as create them using a form … Read more

Keep user’s privileges on accessing contents in JSON response

I use WordPress REST API plugin to fetch WordPress stuff on a mobile app. What Access manager plugin keeps the privileges on REST API responses? I want restrict access to certain posts, categories etc for a particular role, So when the user of that role authenticates via HTTP request, could not access to that post. … Read more

How to allow Unfiltered HTML in a wordpress multisite install

I am trying to create a custom role in a wordpress multisite environment. This role is to have the same capabilities as an admin but also have the ability to commit unfiltered HTML like super admins. I have had success in creating the role and set unfiltered_html to true, but the text editor still strips … Read more