Quantcast
Channel: High Quality Wordpress Themes
Viewing all articles
Browse latest Browse all 10

How to only display the author posts in the admin post list

$
0
0

wordpress-author-post


When you’re running a multi-author blog, it can be very useful to allow each author to only see his own posts in the admin post list. Here is a simple code snippet to do it.

Paste the code below into your functions.php file. Once you saved the file, authors will only see their own posts in the admin post list.

<?php

function mypo_parse_query_useronly( $wp_query ) {
    if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
        if ( !current_user_can( 'level_10' ) ) {
            global $current_user;
            $wp_query->set( 'author', $current_user->id );
        }
    }
}

add_filter('parse_query', 'mypo_parse_query_useronly' );

?>

Thanks to WP Snippets for the code!


Viewing all articles
Browse latest Browse all 10

Trending Articles