Support

Account

Home Forums Backend Issues (wp-admin) Page display only to user with specific acf Reply To: Page display only to user with specific acf

  • It depends on what you want to not show. You would also have to have something on each page. For example a matching “country” field for location where “germany” would be stored.

    Then as an example, to not show the content of the page

    
    $page_country = get_field('location');
    $current_user_id = 0;
    if (is_user_logged_in()) {
      $current_user_id = get_current_user_id();
    }
    if (get_field('location', 'user_'.$current_user_id) == $page_country &&
        get_field('job', 'user_'.$current_user_id) == 'manager') {
      the_content();
    } else {
      echo 'permission denied';
    }