I manage to filter the posts, this seems to be enough for this project
function remove_notallowed_authors( $query ) {
$user = wp_get_current_user();
if ( in_array( 'editor_group_role', (array) $user->roles ) ) {
$user_ids = get_users( [
'role' => 'user_role_that_posted',
'fields' => 'ID'
] );
$query->set( 'author__in', $user_ids );
}
}
add_action( 'pre_get_posts', 'remove_notallowed_authors' );
Related Posts:
- Only view/edit/delete CPT made by users with the same role
- Restrict Access to Posts based on Custom User and Post Meta Data
- Users create/join groups
- Display and Allow users to edit their own profiles
- Allow member to have access to custom post type only. Permission to only edit their own posts
- Possible to hide Custom Post Type UI/Menu from specific User Roles?
- Custom post type role permissions won’t let me read
- Allowing custom role access to custom post type in back end
- How to assign specific users the capability to edit specific pages / posts / custom post types
- Allow user to Edit Posts but not Add New?
- Defining capabilities for custom post type
- Assign a Custom Role to a Custom Post?
- Restrict custom post type view by user role
- Creating custom user roles
- Confusion with adding meta capabilities to a role after registering a Custom Post Type with corresponding ‘capability_type’ parameter
- Can I make user role that can only access a certian content type?
- Create user role restricted to specific CPT
- How to set individual capabilities on a taxonomy? Or how to re-register an existing taxonomy?
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- How to restrict specific post types from being read or added by specific user roles (eg. author)?
- Custom user role not working as expected
- Which User Role for Custom Post Type Menu – wp_nav
- Limit access to page depending on user level
- Role Capabilities: Add New Ones?
- Why does current_user_can(‘edit_posts’) return true, but current_user_can(‘edit_post’, $post->ID) returns false?
- How to publish custom post type for custom role user and not “submit for review”?
- Custom post type capabilities require “create_posts” to access the edit posts list page
- Gutenberg Featured-Image-panel missing when user with custom role edits Custom Post Type
- Limit users by custom taxonomy and user roles
- Add custom capabilities to existing custom post type
- allow edit of custom post type but not regular posts?
- Allow Administrator role access to custom capabilities [duplicate]
- How to enable a custom post type to custom user role in WordPress
- Restrict user to only one custom post type
- only a certain role has access to a cpt
- How to restrict CPT post’s fronted view only for specific user roles?
- current_user_can() return FALSE but debugging says TRUE
- Display content based on a users login
- map_meta_cap woes
- Roles for Custom Post Types
- can’t see custom post content filtered under “mine” filter in admin panel
- Custom post types as sub menu pages and role capabilities issue
- Hiding posts by other users and non-logged in
- WordPress multiple custom post types capability conflict in a single menu
- Cluster CPT posts to users based on ACF value from their profile on dashboard
- How to set individual capability of post type in individual category
- Giving permission to anyone (non-users as well) with a password to edit a post, possible?
- I want to create custom post in which user can share files like PDF & DOCx
- WooCommerce Customer Role Delete Custom Post Type
- Allow Contributor to edit but not update a published post
- Disable user from updating certain posts
- “Submit for review” for updates on existing posts
- Access to CPT but not to ‘post’ post type
- Deny user access to edit post while allow him to edit custom post type
- Query posts based on the meta key values of logged-in users?
- How to show featured image block in custom post type for Author?
- WordPress custom post type capabilities issue
- Custom User role not working with custom post type
- Building Forums with Custom Post Types
- WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”
- Select other roles as custom post authors
- Meta box with front-end styling
- Change user role when user’s first post gets published
- Clone wp-admin/users.php (Users Admin Page)
- Create WordPress User in backend, and automatically create a new post in Custom Post Type with user uame as the Title in the post
- Why “Mine” is the default view when adding ‘capability_type’ in register_post_type
- Create relationship between custom post types and users
- Restrict admin pages for specific user role
- Remove plugin settings from post creation page for a user role
- Creating a custom post type upon registration for a specific user role
- How to select meta key in custom database query
- Allowing custom role user to edit post assigned to them but don’t let them create new custom type post
- I want to show post details based on roles user login
- Multiple useres editing specified content
- Instructor can view, edit, delete only theirs courses
- Front-end submitted post is published with admin ID as author
- Autofill advanced custom field with user data
- WooThemes – Vendors / Bookings – Allow Vendors to manage resources
- Front End users account with lots of user Roles (not Woocommerce)
- Capibilities of CPT WordPress
- Editor role isn’t seeing specific post type posts with only post_type parameter
- Creating multiple profiles under one user to assign to particular posts
- Allow viewing the edit screen for a post type, but not make/save/publish/update changes
- Control what custom posts a user can see
- Custom Post Type only display items created by user
- Prevent author role from editing others posts
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- creating different edit screens for different roles
- Custom taxonomy archive is visible to only subscibed users
- CPT, Custom User Role and problem with user manager
- Display a post count from a custom metabox selection
- Multisite – Echo admins profile meta
- Updating User Meta from Custom Post Field Upon Publish Not Working
- Custom Post Type supports author
- Custom post type & role issues
- Custom role can’t create permalink
- Read-Only custom post type
- Custom Plugin w/ Custom Post Types – Custom Posts Are Showing at all Privilege Levels – Is this possible to adjust?
- How to display Author Profile based on Custom field value
- How can I get user URL by id