• Is it possible to write a query to search for data from one custom field only? I have a CPT called ‘lectures’ and I only want to search for data that is in the custom field called ‘keywords’ I have this:

    <?php
    $args = array(
    'post_type' => 'lectures',
    'order' => 'ASC',
    'posts_per_page' => -1,
    'meta_key' => 'keywords
    
    );
    $query = new WP_Query($args);
    while ( $query -> have_posts()) : $query -> the_post();
    
    ?>

    but it is not working.
    So if someone searches for ‘Operant Conditioning’ (one of the terms in the keywords ACF). I want to search the ACF with those ‘keywords’ (from the ACF) to show in results. I cannot add a specific keyword( value = keyword) as there will be hundreds

    • This topic was modified 4 years, 8 months ago by kevinritt.
    • This topic was modified 4 years, 8 months ago by kevinritt.
    • This topic was modified 4 years, 8 months ago by kevinritt.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘pulling terms from ACF in search results’ is closed to new replies.