Add capability to a role , so user is only able to view his own posts

First of all you need to remove capability edit_others_posts if assigned to vendor role. Then use the code snippet given below: function posts_for_current_author($query) { global $pagenow; if( ‘edit.php’ != $pagenow || !$query->is_admin ) return $query; if( !current_user_can( ‘edit_others_posts’ ) ) { global $user_ID; $query->set(‘author’, $user_ID ); } return $query; } add_filter(‘pre_get_posts’, ‘posts_for_current_author’); Above code allows … Read more

WordPress remove capability post ,media completely for custom role

Remove a top level admin menu: function custom_menu_page_removing() { remove_menu_page( $menu_slug ); } add_action( ‘admin_menu’, ‘custom_menu_page_removing’ ); To remove only certain menu items include only those you want to hide within the function. To remove menus for only certain users you may want to utilize current_user_can(). You can take a look at https://codex.wordpress.org/Function_Reference/remove_menu_page