Hi,
i’ve a problem with a pre_get_posts filter:
add_filter(‘pre_get_posts’, ‘posts_for_current_author’);
function posts_for_current_author($query) {
global $user_level;
$user = wp_get_current_user();
if($user->roles[0] != ‘administrator’) {
global $user_ID;
$query->set(‘author’, $user_ID);
unset($user_ID);
}
unset($user_level);
return $query;
}
I want show to individual authors only their post, this filter work fine but the user can’t show the custom field (created by administrator user)!
Can I set that a user can only see posts/pages that has created BUT including all associated custom field?
Thanks
Hi,
i solved it this way:
if( isset($query->query_vars[‘post_type’]) && $query->query_vars[‘post_type’] == ‘acf’ ){
return $query;
}
Thanks for your excellent plugin!