• Hi all,

    I have tried for hours trying to get a custom field to query in my script and nothing shows. What am I doing wrong?

    <?php
    function jobs_search_results() {
           ob_start();
    
           $jobs_search_results_args = array (
               'meta_query' => array (
                   array (
                       'key' => 'client_state',
                       'value' => 'Alabama'
                   )
               )
             );
    
           $jobs_search_results_query = new WP_Query( $jobs_search_results_args );
    
           if ( $jobs_search_results_query->have_posts() ) : while($jobs_search_results_query->have_posts()) : $jobs_search_results_query->the_post();
    
           the_title();
    
           endwhile;
                  $sc = ob_get_contents();
    
           	/* Clean buffer */
           	ob_end_clean();
    
           	/* Return the content as usual */
           	return $sc;
           endif;
    
           // Restore original Post Data
    
    }
    add_shortcode( 'jobs-search-results', 'jobs_search_results' );

    https://wordpress.org/plugins/advanced-custom-fields/

  • The topic ‘Can't seem to Query an ACF’ is closed to new replies.