WordPress.org

Ready to get started?Download WordPress

Forums

How to allow contributors to view/edit their own posts only (3 posts)

  1. jackjermey
    Member
    Posted 4 years ago #

    Is there a way to allow contributors to see only their own post and edit while disallowing them to do anything else?

    I've been looking around for a solution but the closest one is http://www.kpdesign.net/wp-plugins/wp-hide-dashboard provided but it is not what I'm looking for.

    I want contributiors to view their post only (by default they can view all posts by other authors as well) and edit their own profile.

    Any solution?

  2. Nirok
    Member
    Posted 4 years ago #

    function posts_for_current_author($query) {
    	global $user_level;
    
    	if($query->is_admin && $user_level < 5) {
    		global $user_ID;
    		$query->set('author',  $user_ID);
    		unset($user_ID);
    	}
    	unset($user_level);
    
    	return $query;
    }
    add_filter('pre_get_posts', 'posts_for_current_author');

    put this in functions.php

  3. patter38
    Member
    Posted 4 years ago #

    I tried this and it just gave blank pages. I'll keep looking...

Topic Closed

This topic has been closed to new replies.

About this Topic