Remove add post for user role

This is not possible using the capabilities system, the granularity you want does not exist in WP core: edit_posts Since 2.0 Allows access to Administration Screens options: Posts Posts > Add New Comments Comments > Awaiting Moderation https://wordpress.org/support/article/roles-and-capabilities/#edit_posts edit_posts covers both viewing, adding, and editing posts, as well as commenting. There is a capability that … Read more

Conditional editing CPT – using editor’s role and author’s usermeta

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’ );

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)