Capability to edit post slugs

If it’s supposed to edit its own post only, make it with author‘s capabilities. If it should edit posts of other users, as well, make it with editor‘s capabilities. Case 1 function wpse_add_your_role() { $role = get_role( ‘author’ ); if ( ! empty( get_role( ‘your_role’ ) ) ) { remove_role( ‘your_role’ ); } add_role( ‘your_role’, … 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

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