WordPress Users Search
-
Hi, I created an Ajax search where users can search custom post types and the results will automatically come up, here is the code. I need to know what changes I can make to this code so it searches WordPress Users by their names and some custom post types that I have created.
Thanksadd_action('wp_ajax_nopriv_data_fetch','data_fetch'); function data_fetch(){ $the_query = new WP_Query( array( 'posts_per_page' => 10, 's' => esc_attr( $_POST['keyword'] ), 'post_type' => array ('capabilities' , 'industry-users') ) ); if( $the_query->have_posts() ) : while( $the_query->have_posts() ): $the_query->the_post(); ?> <a href="<?php echo esc_url( post_permalink() ); ?>"><?php the_title();?></a> <?php endwhile; wp_reset_postdata(); else: echo '<h3>No Results Found</h3>'; endif; die(); }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘WordPress Users Search’ is closed to new replies.