2021-12-10

Tech Programing

程式人小天地

WordPress search with meta_query not returning results

1 min read


I have a custom query that runs for job searches. If I remove the meta_query I get al jobs that match my $search_term value. I checked to ensure the published job has the correct key and value as a custom field. However, no jobs are returned.

array( 
        'post_type' => 'job',
        's' => $search_term,
        'order' => 'DSC',
        'orderby' => 'date',
        'posts_per_page' => get_option('posts_per_page'),
        'paged' => $paged,
        'meta_query' => array(
          array (
            'key' => 'publish_phone_number',
            'value' => 'Yes'
          )
        )
      )

This runs through the WP_QUERY method.



Source link

資料來源:Stackoverflow

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *