We’ve been using the following block of code with URE Pro for the last several years to redirect based on some custom criteria. Well recently indiviuals with the custom role of Scholarship can no longer sign in. Instead they see an infinite redirect loop to this page: /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=tribe_events
. Any ideas how to fix. This filter was based off the one provided in the docs: https://www.role-editor.com/documentation/hooks/ure_restrict_edit_post_type/.
`
// URE to allow Scholarship Role access to Scholarship plugin while restricting Pages for user; and allow Applications & Tools Role access to Applications & Tools CPT while restricting Pages for custom Page Editor role
add_filter(‘ure_restrict_edit_post_type’, ‘exclude_posts_from_edit_restrictions’,10,1);
function exclude_posts_from_edit_restrictions($post_type) {
$restrict_it = $post_type;
$user = wp_get_current_user();
if ( empty( $user) || !is_array( $user->roles ) ) {
return $restrict_it;
}
if ( in_array( ‘scholarships’, $user->roles ) ) { // Role ID
if ($post_type==’scholarship’) { // CPT ID
$restrict_it = false;
}
}
elseif ( in_array( ‘custom-page-editor’, $user->roles ) && in_array( ‘applications_tools’, $user->roles )) { // user has both roles at the same time
if ( $post_type===’app_tool’ ) {
$restrict_it = false; // Do not restrict editing for Applications & Tools
}
}
elseif ( in_array( ‘custom-page-editor’, $user->roles ) && in_array( ‘course_selections’, $user->roles )) { // user has both roles at the same time
if ( $post_type===’course-selection’ ) {
$restrict_it = false; // Do not restrict editing for Course Selection guide
}
}
return $restrict_it;
}
// end URE to allow Scholarship Role and Applications access
`