Change WordPress user roles and capabilities Forums How to or FAQ Access to all Posts of a specific Custom Post Type and limit other Pages by ID Reply To: Access to all Posts of a specific Custom Post Type and limit other Pages by ID

#6735
Vladimir
Keymaster

This version just adds additional condition:


if ( in_array( 'scholarships', $user->roles ) ) {  // Role ID
      if ($post_type=='scholarship') {  // CPT ID
        $restrict_it = false;
      }
} else if ( in_array( 'sdol-page-editor', $user->roles ) && in_array( 'applications_tools', $user->roles )) {  // user has both roles at the same time
      if ( $post_type==='app_tools' ) {
	   $restrict_it = false;  // Do not restrict editing for Applications & Tools
      }
  }