Extend WordPress search to include user search

There is many a WordPress plugin out there that enhances WordPress search but I have yet to find a plugin that will add user search.

Search Everything used to have the functionality but was removed when WP moved to version 2.8. I suspect this was due to the way WP changed how authors were stored.

The reason why I’m after user search is because all users on the WP site are staff members with their own profile. We have an author page that lists all staff by surname that is separated by 20 members per page. If you only know the first name of a member of staff then trying to find that member is very hard. I want to extend WP search so you can simply enter a name and the corresponding member shows up.

This site is an intranet so using an external search engine is out of the question.

Just want to be clear that I’m wanting to search for users not search for posts by author.

How can I get staff member search added?

2 s
2

You can’t achieve this easily with WP’s built-in search system. Even if you managed to build a complicated query that pulls data from the user table, it would be incredibly slow.

Search Unleashed had this functionality, but I’m not sure about compatibility with WP 3.2.

I used it in the past as inspiration to add better search functionality on my site. Basically it gathers data on content publishing hooks, which then gets indexed and stored somewhere for faster accessing, for example a custom db table, or in special files if you’re using the Lucene search engine.

If you really want to go the WP way, see this question. You need to join $wpdb->users on post_author.

Leave a Comment