same user role or copy the user role to be same as the other role

Contributor has the following capabilities delete_posts edit_posts read You can create the “Seller” role to have same capabilities as Contributor add_role( ‘seller’, __( ‘Seller’ ), array( ‘read’ => true, ‘edit_posts’ => true, ‘delete_posts’ => true, ) ); Warning from codex NB: This setting is saved to the database (in table wp_options, field wp_user_roles), so it … Read more

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

Let editors view post in admin but not be able to perform a save/edit

How about remove_meta_box( $id, $page, $context );? https://codex.wordpress.org/Function_Reference/remove_meta_box This will remove the Publish meta box which contains the save button… function disable_save() { if( !current_user_can( ‘edit_post’ ) ) { // Or whatever check you need to make remove_meta_box( ‘submitdiv’, ‘your-chosen-post-type’, ‘side’ ); } } // disable_save add_action( ‘admin_menu’, ‘disable_save’ );

Redirect admin 403 “Cheatin uh?” admin pages

Sounds like this is what you’re running into. admin_page_access_denied may be the hook you want to use for this. try function dont_show_cheatin_page() { if ( current_user_can( ‘do_not_allow’ ) ) { wp_safe_redirect( admin_url()); // custom redirect instead of Cheatin 403 page exit; } } add_action(‘admin_page_access_denied’, ‘dont_show_cheatin_page’);

Custom Post Type – after disable ‘Add New’, I can’t edit and delete post

Full credit to this answer on Stack Overflow: you need to set the create_posts value to do_not_allow (or false in WordPress versions below 4.5) and crucially set the map_meta_cap to true: register_post_type( ‘custom_post_type_name’, array( ‘capability_type’ => ‘post’, ‘capabilities’ => array( ‘create_posts’ => ‘do_not_allow’, // Prior to WordPress 4.5, this was false ), ‘map_meta_cap’ => true, … Read more

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