/ Documentation /General/Restrict Schema Pro Settings for Specific User Roles

Restrict Schema Pro Settings for Specific User Roles

Schema Pro provides global and page level settings.

  1. Global settings are available in the dashboard under Settings > Schema Pro. You can add new schema types and configure other plugin options.
  2. Page level settings are available on the individual pages/posts. Read about page-level settings here.

Administrator user role have access to both type of settings. But sometimes you might need to share access with other user roles too.

Schema Pro offers a custom code that lets you add access to other roles as well.

The thing to note here is – you can only share access for page-level settings to other user roles.

Example – Job Posting schema settings on single page –

Let’s see how it works –

Add following custom code (filter) to your child theme’s functions.php file with appropriate user role. Following code works for ‘editor’ user role.

add_filter( 'wp_schema_pro_role', 'function_name');
function function_name( $roles ){
$new_roles = array('editor');
$roles = array_merge($roles,$new_roles);
Return $roles;
}

You can use any of the following user role as per requirement-

  • editor
  • author
  • contributor
  • subscriber

You can add more than one user role separated by a comma. Example – Using editor, author contributor in following code –


add_filter( 'wp_schema_pro_role', 'function_name');
function function_name( $roles ){
$new_roles = array('editor','author','contributor');
$roles = array_merge($roles,$new_roles);
Return $roles;
}
Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top