WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Any ideas to restrict viewing of posts to post author only? The twist: Restrict both back AND frontend. I'd like to avoid the role scoper plugin.

Example: The author creates a post, and can now view live on the site, as well as in the admin panel. They can edit, trash, whatever. But only admins and the author can see the post. (Looking for task/project/helpdesk/use.

share|improve this question

to restrict on the back-end you can use the default author role.

and on the front-end you ca use something like:

function check_rights_8876(){
    global $post,$current_user;
    if ( is_user_logged_in() ) {
        if ( current_user_can('manage_options') ){// admin
            return true;
        if ($author_id = $current_user->ID ){// curent post author
            return true;
    return false;

Once you have this function defined you can check before displaying the post like this:

if (check_rights_8876()){
    //display the post
    //Sorry but you don't have rights to access this post massage here

Hope this helps

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.