Skip to main contentSkip to footer

Relevanssi Premium can search user profiles. So far the following data gets indexed from user profiles: first name, last name, display name and description. If you’re interested in having something else indexed, there’s an option on the options page.

Because WordPress only handles posts in the search result pages, Relevanssi must make WordPress believe it’s getting posts, even though it gets user profiles. This causes some problems, which are fortunately fairly easy to fix with some changes to search results templates.

Some problems are already taken care of. Relevanssi contains a filter that should fix the_permalink() for user profiles.

It’s easy to recognize the user profiles. You can test the value of $post->post_type, it’s ‘user’ for user profiles.

To make things slightly easier, there’s a filter hook. You can add a filter to relevanssi_user_profile_to_post to make changes to the post object created from the user profile. It has the basic values already set.

Your account

Not logged in. Log in to see your license details.

Search

Popular Resources

Related Posts:

Comment Section:

71 Comments. Leave new

  • Hi Mikko,

    Long-time user.

    How might I go about ordering a query of users by the last_name field?

    Reply
    • Steve, there’s no easy way to have Relevanssi sort the results by a user meta field, so the easiest solution is to create a relevanssi_hits_filter function that will sort the results by the last_name field.

      Reply
  • Hi,

    You say the plugin can index any field if you can access it from a php function. But you also say it does not support Buddypress. I have heavily customised Buddypress and added many fields/taxonomies and ACF fields etc to profiles. What are you meaning is ‘not supported’ if I can tweak to index any fields?

    Is it the destination link? Can I not just use a filter to redirect the results link to the Buddypress profile url instead of normal WP profile pages?

    Reply
    • I’m not even sure what the actual problem with BuddyPress is, I don’t know BuddyPress well enough. All I know is that Relevanssi has had lots of problems with it.

      You can definitely index any fields for a user profile, that’s not a problem. You can also use filters and your search results template to point the results to the profile. So if that’s all there is to BuddyPress, then sure, it should work out fine. I can’t really say anything else here than to try it out yourself, and that I can’t really support the combination, because I know nothing of BuddyPress.

      Reply
  • um ok it CAN index user profiles, where is the check box for that? I am no PHP programmer and adding hooks is for hanging pictures on my walls.

    But seriously how to make this expensive plugin to search users? it doesnt out of the box?

    Reply
  • No I don’t, I ‘ll satrt by buying the pro version 😉

    Reply
  • Hello All
    Is it possible to search user with ACF Profile fields ?
    I mean searching user with certain info in ACF field link to WP Profile?

    Reply
    • Sébastien, yes, it’s possible to search users by ACF fields, but you probably have to connect the fields to the user profiles manually. It’s a simple task, though, just requires adding one function to tell Relevanssi which fields you want to include.

      Reply
      • OK Thx Mikko
        ACF Fields are already linked to profile, I tried FacetWP but they don’t search on user list.
        All docs are accessible to setup ?

        Reply
        • Have you listed the names of the fields in the “relevanssi_index_user_fields” option? If not, try that first. That option should contain a comma-separated list of user fields you want to include in the index.

          If that doesn’t help, you can use the “relevanssi_user_add_data” filter hook to add the field contents to the user object before it is indexed.

          Reply
  • Hi Mikko,

    Great plugin!

    Everything is working great except for the Author search results where all title links are going to domain .com /2017/10/21 instead of the domain .com /author /name…

    All other searches are working well including the title link and the read more link.

    Thx in advance for your help!

    Reply
  • Hi,

    I have a lot of registered user profiles. Registration was done with Ultimate Member and there is a lot of data stored in the users meta. Also some data which should not be displayed.

    Is it possible to exclude some search results from the users meta?

    Thanks!

    Reply
  • Erik Teichmann
    June 20, 2017 6:29 pm

    How can I filter results to *only* include users, or, to exclude users?
    I have a series of checkboxes in my search form with name=”post_types[]” — this works for my other post types, but doesn’t seem to do the job for users. Thoughts?

    Reply
    • Setting “post_types” to “user” is the way to go, but it’s quite possible it doesn’t work quite right in the current version. This is something I’ve worked on recently, and something that will be fixed in the next version.

      Meanwhile you can use “relevanssi_hits_filter” to filter the results by post type.

      Reply
  • Hello. this plugin allows searching for users profile field and show, as a result a list of posts belonging to the users that fulfilled the searched criteria?

    Reply
    • By default Relevanssi only shows the posts based on user name. However, Relevanssi has filters you can use to add any content you want to to the index, so you can make Relevanssi index exactly those user fields you need.

      Reply
  • Does is support buddypress

    Reply
  • is it possible to search users with extended profiles such as company name, phone number, area of expertise created in gravity form with User Registration Add-on? I will buy the premium version if it can achieve this.

    Reply
    • Given that I don’t know how the data in User Registration Add-on is stored, I can’t say for sure, but I’m fairly sure the answer is “yes”. Relevanssi has a filter hook you can use to add pretty much anything you want to user profiles before they are indexed, so if you can access the extended profile data from a PHP function, you can have Relevanssi index it.

      Reply
  • hi, can Relevansi Premium search Custom Fields added to users table?

    Reply
  • Keith Pearson
    May 16, 2015 5:43 pm

    Okay, maybe I’m being an idiot but to enable the search results to display users profiles (in bbPress in my case), I have to change the setting in the admin to allow for profile searches, then edit some code?

    Sorry but it’s not clear from your post what file we need to edit and precisely what we need to add/edit in that file. And in the admin section where you have the ability to index profiles, it just says “Requires changes to search results template, see Relevanssi Knowledge Base”. So here I am again and I’m still none the wiser.

    And I should state that I’m using the Premium version.

    Reply
    • Since you’re using Premium, please use the Premium support: https://www.relevanssi.com/support/

      Like the Relevanssi settings page says, you need to edit the search results template, which is usually search.php (not always, though, that’s why I can’t tell you exactly which file it is).

      Usually replacing “the_permalink();” on the search results template with “echo relevanssi_get_permalink();” is enough.

      Reply
  • “Relevanssi can search user profiles. So far the following data gets indexed from user profiles: first name, last name, display name and description. If you’re interested in having something else indexed, there’s an option in the options page.”

    where is this option, i cant see it on the options page

    Reply
    • Are you using the free version of Relevanssi? Then that’s your problem. None of this applies to the free version, you need Relevanssi Premium to index and search user profiles.

      Reply
  • I am new to all of this. I want to make the search look through user names and other user profile fields. Here is my search template code, what do I need to change to make it search users?

    <?php printf( __( 'Search Results for: %s', 'twentytwelve' ), '’ . get_search_query() . ” ); ?>

    Reply
  • Oludotun Olojede
    June 2, 2014 10:25 pm

    I am creating a new directory site that can display information like company name and pie chart based on user profile information as search result when visitors do a search on the website. Please can relevanssi help

    Reply
  • Muhammad Abid Saleem
    January 20, 2014 8:58 am

    Ok thanks

    Reply
  • Muhammad Abid Saleem
    January 20, 2014 8:45 am

    Hello,

    I
    am using the Relevansi Premium its working fine. I have a question how I can modify
    search results template/listing style structure is there any setting available?

    Reply
  • Muhammad Abid Saleem
    January 16, 2014 3:55 pm

    ok Thanks,

    Reply
  • Muhammad Abid Saleem
    January 16, 2014 3:42 pm

    Hello Mikko,
    How are you ? Dear Mikko I have a question regarding Search.

    Question:- I have two type of user packages.

    1- Platinum package
    2- Basic package (Free)

    Currently I am using the Relevansi Premium. And its working fine and search the results that includes the users as well. My goal is to search users package wise first all sorted users list who have platinum/paid package after this all users list who have basic/Free package.
    Can I achieve my goal by using your plugin? If Yes, Then please tell me how I can
    do this.

    Reply
  • Hi Mikko. I have another quick question. Is there any way we can separate the posts results and the user results ?

    Reply
  • I have read that we are able to add an additional column to the search for the user. But don’t know how exactly i can achieve that. I have an additional meta value in the user meta i.e Company Name and i want it to include in the search as well. Can you please explain a bit or share the link from where i can get the help regarding this.

    Reply
  • Is it possible to give the user post type a weight? I’d like to weigh it higher than other post types.

    Reply
  • Hi,
    can you confirm me that with the premium version I can search users filtering with multiple custom user meta fields?
    For example, if implemented custom user meta fields, like age, sex and hobby,
    I need to search users with age: 18, sex: male, hobby: chess…

    Thanks 😉

    Reply
  • Hi,
    I’m looking for a way to search for user metadata on an intranet.
    For example, I’ve added a ‘certifications’ field as user metadata, and that field displays on the Author page for the user. I need the ability for someone to type in a certification in a search box and return either a list of users or author pages that have that certification.
    Is this something this plugin can do?
    Will it handle partial matches, rather than matching the whole field?
    Thanks,
    Nancy

    Reply
  • Hello,

    I am trying to set up just user profile search and so only have that option checked on the options page.

    When I click on build the index I get Warning: Invalid argument supplied for foreach() in /home/smallbu3/public_html/wahalliance.org/wp-content/plugins/relevanssi-premium/relevanssi.php on line 2723

    I would like just User Profile Pages to be indexed in search results.

    Reply
  • Hello. @ Ravishankar Ayyakkannu, if you want a buddypress plugin that searches user profiles, perhaps you should try a plugin called “BP Profile Search” (without tha quotes)

    I hope it works for you.

    @ Mikko Saari, please i am still expecting response to the email i sent you. Thanks.

    Reply
  • Ravishankar Ayyakkannu
    November 14, 2011 5:35 am

    I bought your plugin recently and I am very much frustrated. When i searched for a user’s name,its showing “Sorry, no posts matched your criteria” or It display the list of posts. When i click the users name in search result, it redirects me to the home page. I am using buddy press. I would like to display users profile pic and his name in search result. Please explain me on this.

    Reply
    • Relevanssi may or may not be compatible with BuddyPress; I don’t know, I’ve never tested, and certainly no BuddyPress support is promised. Are those users regular WordPress users? If so, they should be searchable.

      To display profile pictures, you need to edit your search results template to show whatever you want. User profiles have $post->post_type “user”.

      Reply
  • Hi

    I don’t really understand what I need to be able to search for user profiles? Could you please add some code examples?

    /Jens

    Reply
    • 1. Set up the options so that user profiles are being indexed.
      2. Re-index.
      3. That’s it.

      You may need some changes to your search results template, particularly if you’re using the_content(). the_excerpt() and the_permalink() should, however, show correct information.

      Reply
  • Would be great to be able to specify additional user profile fields to index – I’m replacing the Jabber field with a field for the user’s Organisation, and want to be able to run searches to return items contributed by users from a particular organisation.

    Currently, looks like I’ll have to move that into a custom taxonomy of its own to be able to make it searchable in Relevanssi, is that right?

    Reply
    • I could add an option to list the fields to index (or to index all fields). I can make the change in the next version.

      If you want to make a quick fix for it, see how description is handled in relevanssi_index_user() and copy that for any fields you want to index.

      Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Fill out this field
Fill out this field
Please enter a valid email address.
You need to agree with the terms to proceed