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

OceanWP
OceanWP is a popular WordPress theme. It works fine with Relevanssi, but how it handles excerpts on the search results…
Ajax Load More

…of the extension, you can make Ajax Load More use Relevanssi by adding this function to your site: add_filter( ‘alm_modify_query_args’, function( $args ) { $args[‘relevanssi’] = true; return $args; } ); This function enables Relevanssi in the Ajax Load More queries. Every time Ajax Load More loads more results, it…Ajax Load More is an infinite scrolling plugin for WordPress. It has a Relevanssi extension, but with the current versions of Ajax Load More (5.5.4.1 as I write this), the extension no longer does anything. The extension relies on a filter hook that does not exist in the plugin. Instead……counts as a new search for Relevanssi logs. If you don’t like that, you can make Relevanssi only log the first Ajax Load More search. If you want that, use these functions instead of the one above: add_filter( ‘alm_modify_query_args’, function( $args ) { global $rlv_is_offset_query; $args[‘relevanssi’] = true; if (…

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