Home Forums ACF PRO How to use ACF True/False to filter categories?


How to use ACF True/False to filter categories?

  • I’ve looked all over these ACF forums, read the documentation and also looked at similar questions here without success. So, i’m posting with the hopes of figuring out what I’m doing wrong.

    I have a True/False ACF field, mba_exclude, attached to my categories. My goal is to simply have a category not show on the front end when the user turns the field to ‘Yes’, which should exclude that category from showing. I plan to have the majority of the categories shown be by default, which is why I have a true statement there in case the user wants to turn it off.

    $args = array(
         'taxonomy' => 'category',
         'hide_empty' => 0,
         'meta_query'   => [
            'key'       => 'mba_exclude',
            'value'     => '1',
        $c = get_categories($args);

    I get every category still, no matter what. I’ve tried changing the formatting of the meta_query in my code to match the array() style in the ACF docs (above) without success. I’m still newer to using ACF like this, and would appreciate any assistance here. Thanks!

Viewing 1 post (of 1 total)

The topic ‘How to use ACF True/False to filter categories?’ is closed to new replies.