[ad_1]
Hmm. That example snippet definitely looks like it’s covering both searchable posts index and the wp_posts_post index for autocomplete.
Have you verified what’s getting stored and returned in your ACF field? As is with the snippet, it needs to store boolean true, in the form of 1 to be marked excluded.
If your field is storing say '1' as a string, then that check would fail because boolean 1 is not the same as string 1
@tw2113 Thank you for your quick response! You were spot on.
Looking back, I had created the field as an ACF True/False field (not a checkbox as described in the article), which stores as an integer 0 or 1 not as a boolean.
Changing the line: if ( 1 === $excluded ) {
to: if 1 == $excluded ) {
did the trick.
Many thanks!
