Skip to main contentSkip to footer

Relevanssi Premium can index user profiles. Users may have meta fields attached to them: there’s a wp_usermeta database table, even though the user editing interface by default doesn’t have any tools to add meta fields to users.

Codex includes documentation on how to use the user meta fields. Read Working with User Metadata for code examples. I’m sure there are also plugins that can help with this.

Relevanssi settings page doesn’t contain a setting for indexing user meta fields. There’s, however, a hidden option you can use to index user custom fields. You can either set the option or use the pre_option_ filter hook to feed it.

Let’s say you want to index three custom fields: field_A, field_B and field_C. Add one of these functions to your site and rebuild the index to index the custom fields:

add_filter('pre_option_relevanssi_index_user_meta', 'rlv_index_user_meta_fields'); 
function rlv_index_user_meta_fields( $value ) { 
    return 'field_A,field_B,field_C';
}

or simply:

update_option( 'relevanssi_index_user_meta', 'field_A,field_B,field_C' );

Your account

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

Search

Popular Resources

Integrating Koko Analytics stats
It’s possible to integrate all kinds of external data to Relevanssi weights. Koko Analytics is a great analytics plugin. It…
Direct access to the query engine
Relevanssi can’t be used in any situation, because it checks the presence of search with the is_search() function. This causes some…

Related Posts:

Comment Section:

2 Comments. Leave new

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