Home › Forums › Backend Issues (wp-admin) › Backend shows information only of own user › Reply To: Backend shows information only of own user
A quick snippet for you:
add_action( 'pre_get_posts', 'filtre');
function filtre($query) {
//echo '<pre>'.print_r($query->query_vars['post_type'], true).'</pre>';
switch($query->query_vars['post_type']){
case 'attachment': // Media library
if( current_user_can('manage_own_media') ) $query->set('author', get_current_user_id() );
break;
case 'post': // Posts
if( current_user_can('manage_own_posts') ) $query->set('author', get_current_user_id() );
break;
case 'page': // Pages
if( current_user_can('manage_own_pages') ) $query->set('author', get_current_user_id() );
break;
} // switch post_type
return $query;
}
Of course this is assuming that there are custom permissions set up using the User Role Editor!
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.