Change WordPress user roles and capabilities › Forums › Give user access to plugin – how to › Limit user to changing a single page & add events through multiple plugins › Reply To: Limit user to changing a single page & add events through multiple plugins
26/04/2018 at 16:10
#4805
Vladimir
Keymaster
Hi Arie,
Code for user with 2 roles to exclude from the edit restrictions 2 mentioned custom post types may be similar to:
add_filter('ure_restrict_edit_post_type', 'exclude_posts_from_edit_restrictions');
function exclude_posts_from_edit_restrictions($post_type) {
$restrict_it = true;
$current_user = wp_get_current_user();
if (!in_array('hetbakenbeheer', $current_user->roles) || !in_array('kerkdienstplanning', $current_user->roles)) {
return $restrict_it;
}
$do_not_restrict = array('event', 'ctc-event');
if (in_array($post_type, $do_not_restrict)) {
$restrict_it = false;
}
return $restrict_it;
}