How to Show Only the Author’s Posts in the Edit List

How to Show Only the Author’s Posts in the Edit List

Every now and then users on the forums request a way to show only the author’s own posts in the “All Posts” screen. Here’s a quick snippet that you can add to your theme’s functions.php file.

Adding this code will restrict the posts page to display only the author’s own posts, instead of posts created by all authors on the site.

{code type=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’ );

This code snippet comes to you courtesy of our friends at WP-Snippets. Add it to your site if you want to keep authors from getting into each other’s posts.

Free Video Why 100 is NOT a Perfect Google PageSpeed Score (*5 Min Watch) Learn how to use Google PageSpeed Insights to set realistic goals, improve site speed, and why aiming for a perfect 100 is the WRONG goal.
Tags: