Support

Account

Home Forums Add-ons Repeater Field Search Terms with Repeater fields with Like clause

Solving

Search Terms with Repeater fields with Like clause

  • Hi, i have taxonomy called procedure_pricing and a repeater field called CPT Codes
    which have two sub fields cpt code and explanations

    Now i want field with these two sub fields i-e when someone type 55669 in search box it will search with cpt code or explanations with like clause. I wrote a meta query for this but its replace % with a385a6af49a8dfdf1dccca68e1208bd4913a3a3bb8f93b3448ab22e7d00bd473

    I saw some hacks for wp_Query but not find out for term query.

    Here is my code

    $args = array(
                          'taxonomy'   => 'procedure_pricing',
                          'meta_query'  => array(
                            'relation'    => 'OR',
                            array(
                              'key'   => 'cpt_codes_%_cpt_code',
                              'compare' => 'like',
                              'value'   => $txt,
                            ),
                            array(
                              'key'   => 'cpt_codes_%_explanation',
                              'compare' => 'like',
                              'value'   => $txt,
                            )
                          )
                        );
          $the_query = new WP_Term_Query($args);
          $terms = $the_query->get_terms();
          print_r($the_query);

    Generated query is
    [request] => SELECT DISTINCT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_termmeta ON ( t.term_id = wp_termmeta.term_id ) INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN (‘procedure_pricing’) AND (

    ( wp_termmeta.meta_key =

    ‘cpt_codes_{680588a45e704}_cpt_code’

    AND wp_termmeta.meta_value = ‘J1030’ )

    I have trim some words {680588a45e704} so it will be readable on site.. its very long string originally
    Can you please help with this

  • any luck with this? im also trying to do something similar to this

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

The topic ‘Search Terms with Repeater fields with Like clause’ is closed to new replies.