March 24, 2013

WordPress Tricks: Let Author See Own Articles

WordPress defined different user roles. These roles let administrator manage blog contributors works better. For an Author role in WordPress, they can not see much information from the dashboard. Sometimes, we may want to see what we have published. This 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.

Category: Web Tags: 59 Views

Leave a Reply

Required fields are marked *

Name *

E-Mail *

Website