Viewing 1 replies (of 1 total)
  • Plugin Author Bainternet

    (@bainternet)

    Yes if you create a function and hook it to the instant_search_res filter hook, e.g:

    add_filter('instant_search_res','user_by_meta_instant_search');
    function user_by_meta_instant_search($res,$q){
    	$user_query = new WP_User_Query(
    		array(
    			'meta_key'   => 'Your_META_KEY',
    			'meta_value' => $q
    		)
    	);
    	// User Loop
    	if ( !empty( $user_query->results ) ) {
    		$results = array();
    		foreach ( $user_query->results as $user ) {
    			$results[] = array(
    				'title' => $user->display_name,
    				'content'=> get_avatar( $user->ID, 64 ),
    				'url' => get_author_posts_url( $user->ID)
    			);
    		}
    		return $results;
    	}
    	return $res;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘addin users to search’ is closed to new replies.