Support

Account

Home Forums General Issues ACF subfield and WordPress combined search

Unread

ACF subfield and WordPress combined search

  • I want to live search the posts with meta query in it.
    There are repeaters inside the repeater field like

    Post Type: Post
    Level1 Repeater: Level1
    Level1 Sub field repeater(Level 2) : Level 2
    Level 2 repeater subfields: description, title, number

    I want a query to show the post by matching the provided search text like ‘co’, which search the post title, the subfield description, and number and returns the matching post.
    Is there any way to achieve this?
    Below is my query show far.

    $post_meta_args = array();
    if ( is_array( $myValues ) || is_object( $myValues ) ) {
    foreach ( $myValues as $value ) {
    array_push( $post_meta_args, array(
    'key'     => 'description',
    'value'   => 'mar',
    'compare' => 'LIKE'
    ) );
    }
    }
    $args = array(
    'post_type'      => 'post',
    'posts_per_page' => - 1,
    's'              => 'co',
    'meta_query'     => $post_meta_args
    );
    
    // query
    $the_query = new WP_Query( $args );
Viewing 1 post (of 1 total)

The topic ‘ACF subfield and WordPress combined search’ is closed to new replies.