Change WordPress user roles and capabilities Forums How to or FAQ Post Restriction not working unless refresh browser on Pages Reply To: Post Restriction not working unless refresh browser on Pages

#6745
Vladimir
Keymaster

It seems I fixed the issue. Make another test and share the result.

The reason was at the filtering code from functions.php:


$ag = get_field('analytics_group_name','user_' . $current_user->ID);
if ( !isset( $ag ) ) {
     return '';
}

get_field() may return ”, and !isset() check was wrong in the such case. I replaced !isset() with empty():


if ( empty( $ag ) ) {
    return '';
}

and ‘Pages’ started to open with the single page only.