Hi I'm using this code to make only the admin see all the posts and editor users can see only their own added posts, but it is also restricts custom feilds form showing when I add or edit any post using an editor user (The fields inside the post page), how can I exclude the custom fields so all the users including editors will be able to see them on each post page.
add_shortcode('pledge_count', 'get_pledge_count');
add_filter( 'pre_get_posts', 'fb_pre_get_posts' );
function fb_pre_get_posts( $queryobj ) {
if(is_admin()){
if ( ! current_user_can( 'edit_users' ) )
$queryobj->query_vars[ 'author' ] = get_current_user_id();
}
return $queryobj;
}