Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • for search I am using this function
    This is working fine on searching post with post title, post content and from ACF fields on post. but not from author.

    add_action( ‘wp_ajax_search_cposttype’, ‘searchCposttypeByTerm’ );
    add_action( ‘wp_ajax_nopriv_search_cposttype’, ‘searchCposttypeByTerm’ );

    function searchCposttypeByTerm() {
    //$authors=get_users();
    $wp_query = new WP_Query(array(
    ‘post_type’=>’cposttype’,
    ‘post_status’=>’publish’,
    ‘s’ => $_GET[‘searchTerm’]));

    while ($wp_query->have_posts()) : $wp_query->the_post();
    get_template_part(‘template-parts/cposttype/cposttype-post’);

    endwhile;
    wp_die();

    }

    Hi
    I also tried to call the user name, using field type ‘User’
    It displayed the User Name on eash post by using
    <?php
    $values = get_field(‘ztest’);
    if($values){
    $array = array_values($values);
    echo $array[5];
    }
    ?>

    but when I search on WordPress Search input box, it gives search result with other ACF values but did not give search result from ACF field type ‘User’ value.

    The author name could be displayed by using only below code
    <?php the_author_meta( ‘display_name’ ); ?>
    but no search result from both of this.

    Please could you help me on this.
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)