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';
}
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.