Default All Posts to the Current User’s Posts

When clicking on All Posts in the main menu, Administrators and Editors will normall see all posts. Use this to change the default view to the user’s own posts. See comments to limit the change to users of a certain roll.

add_action( 'admin_menu', 'show_users_posts_by_default' );
function show_users_posts_by_default() {

	/*if current user is an 'administrator' do nothing*/
	//if ( current_user_can( 'add_users' ) ) return;

	/*if current user is an 'administrator' or 'editor' do nothing*/
	//if ( current_user_can( 'edit_others_pages' ) ) return;

	global $submenu, $user_ID;
	$submenu['edit.php'][5][2] = 'edit.php?author='. $user_ID;
}

One thought on “Default All Posts to the Current User’s Posts”

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: