WordPress Tricks: Let Author Role See His Own Posts

WordPress have different user roles. These roles let administrator manage blog contributors works better. Author role in WordPress can not see much information from the dashboard. Sometimes, we may want to see what we have published. At that time, we can uses the following code to let Author see their own posts list.

Copy and paste the following codes into the function.php template:

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

This wordpress trick is very useful for those who run a team blog.

Leave a Reply

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