The basis for making this work is actually pretty simple. Essentially, you just need to hook pre_get_posts
and set the author
query var to the value of the currently logged in user for each type of query you want to limit results on.
function logged_in_user_posts( $query ){
if ( is_user_logged_in() ){
global $current_user;
get_currentuserinfo();
$query->set( 'author', $current_user->ID );
} else {
// force query to return nothing if user not logged in
// you may want to handle this more elegantly
$query->set( 'author', -1 );
}
}
add_action( 'pre_get_posts', 'logged_in_user_posts' );
Now, you’ll probably want to use some conditional tags here to limit what sorts of queries this acts on. For example, this will cause pages to 404 as-is, so you probably want to make sure the query is not for a page:
if( ! $query->is_page() )
EDIT- after a re-read of your question, I think perhaps I’ve misunderstood what you’re trying to do…