Support

Account

Home Forums Add-ons Options Page Querying Options

Helping

Querying Options

  • Is there any way to query fields i’ve setup in my options page? I’m using a repeater field that contains an image field and a checkbox for each repeater row. I’d like to return rows in the repeater, but only if that checkbox is checked. Is this possible without retrieving ALL the rows and looping to check for that checkbox value?

    I’ve read through the documentation about querying for meta values. This makes sense when I’m using a custom post type, but I don’t know how to do it with the options addon.

    Any assistance is much appreciated,

    Thanks.

  • There isn’t any way to query these values the way that the OP is looking for, mostly because MySQL doesn’t have any way to match up the field names that are used for each row or the repeater. The best way to get them is to get the entire repeater an then loop through it.

    
    $value = get_field($repeater, $options);
    

    should return the entire repeater in an array and then you can loop through the array to get what you need.

    Hope that helps someone.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Querying Options’ is closed to new replies.