Support

Account

Home Forums General Issues Meta query with ACF subfields (populated by Formidable Forms)

Helping

Meta query with ACF subfields (populated by Formidable Forms)

  • Hi,
    I found other topics about this issue but after trying all the solutions available, I am still stuck.

    I use Formidable Forms and their add-on Formidable ACF to create posts. It works like a charm with all kind of fields.
    But when I try to do a meta query using a subfield of an ACF repeater field group (which is populated through a Formidable Form) to find some posts, it doesn’t work.

    I use the example : https://www.advancedcustomfields.com/resources/query-posts-custom-fields/#4-sub-custom-field-values

    But my query always returns nothing ( var_dump gives array(0) { } ).
    ———-
    My code :
    function my_posts_where( $where ) {

    $where = str_replace(“meta_key = ‘essai_centres_investigateurs_$”, “meta_key LIKE ‘essai_centres_investigateurs_%”, $where);
    return $where;
    }
    add_filter(‘posts_where’, ‘my_posts_where’);

    $essais = get_posts(array(
    ‘post_type’ => ‘essai_clinique’,
    ‘post_status’ => ‘publish’,
    ‘posts_per_page’ => -1,
    ‘suppress_filters’ => false,
    ‘meta_query’ => array(
    array(
    ‘key’ => ‘essai_centres_investigateurs_$_essai_centre_investigateur’,
    ‘value’ => 1695, // value to search
    ‘compare’ => ‘=’,
    ),
    ),
    ));
    ———-

    Any help would be greatly appreciated as I am becoming mad ! 🙂
    Best Regards,
    Cedric

  • Facing the same issue. No one giving a correct solution

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

You must be logged in to reply to this topic.