Home › Forums › Backend Issues (wp-admin) › Field Groups not showing for custom role › Reply To: Field Groups not showing for custom role
Fixed.
I’ve replaced the above filter with the following from here -> http://blog.rutwick.com/display-only-the-posts-authored-by-the-current-wp-user-on-the-posts-page-in-the-back-end.
add_action('pre_get_posts', 'filter_posts_list');
function filter_posts_list($query)
{
//$pagenow holds the name of the current page being viewed
global $pagenow;
//$current_user uses the get_currentuserinfo() method to get the currently logged in user's data
global $current_user;
get_currentuserinfo();
//Shouldn't happen for the admin, but for any role with the edit_posts capability and only on the posts list page, that is edit.php
if(!current_user_can('administrator') && current_user_can('edit_posts') && ('edit.php' == $pagenow)){
//global $query's set() method for setting the author as the current user's id
$query->set('author', $current_user->ID);
}
}
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.