Code needed to only show users own posts in a multi-user account

Put this into your functions.php file in your theme folder…

function query_set_only_author( $wp_query ) {
    global $current_user;
    if ( is_admin() && !current_user_can('manage_options') ) {
        $wp_query->set( 'author', $current_user->ID );
    }
}
add_action('pre_get_posts', 'query_set_only_author' );

Leave a Comment