FavoriteLoadingAdd to favorites

WPBeginner

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

The post title says it all…
Note: If you cut down admin privileges for user roles as well you can use the admin section for front end posting. Just remember you need to include admin styles differently when its for the admin section. You need a script for the functions.php file.

Pin It on Pinterest

Share This