Home › Forums › General Issues › Control Display of Custom Field › Reply To: Control Display of Custom Field
Hi @toad78
I think I misunderstood your question. I’m sorry about that.
I believe you can add a post object field and then add the pages you want to exclude. After that, you can check if the current page is excluded or not like this:
// Get the excluded IDs
$excluded = get_field('excluded_pages_field', 163, false);
// Get the current post
global $post;
//Check if the current page is excluded or not
if( $excluded && !in_array($post->ID, $excluded) ){
// Your code here
echo "not excluded";
}
I hope this helps 🙂
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.