Home Forums ACF PRO ACF Custom Search Not Searching Page Titles


ACF Custom Search Not Searching Page Titles

  • What I am doing is searching through all my custom post types and all my ACF fields then displaying the link and title to the page where the search term is located. I have on page title that is not included in any of the ACF fields that I am searching, that is how I know my search is not looking at that page titles at all. My code is below any help would be great.

    <h2>Search results for: “<?php echo $_GET[‘search’]; ?>”</h2>
       $posttype = get_post_type();
       $search = $_GET[‘search’];
       $args = array(
         ‘post_type’ => $paged,
         ‘posts_per_page’ => ‘-1’,
          ‘meta_query’ => array(
           ‘relation’ => ‘OR’,
            ‘key’ => ‘region-inner-hero-header’,
            ‘value’	=> $search,
            ‘compare’ => ‘LIKE’,
    $query = new WP_Query( $args );
    if ( $query->have_posts() ) { ?>
    <?php while ( $query->have_posts() ) {
    $query->the_post(); ?>
    <?php $page = get_the_title(); ?>
    <?php } ?>
    <?php } else {
    echo “Sorry, no results were found here”;
Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.