Skip to main contentSkip to footer

From the Relevanssi settings, you can only choose whether subscribers are indexed or not.

If you need finer control over what user roles are indexed by Relevanssi, you can use the relevanssi_user_index_ok filter hook with the following code. Place it in your theme functions.php:

add_filter( 'relevanssi_user_index_ok', 'rlv_do_not_index_admins', 10, 2 );
function rlv_do_not_index_admins( $do_index, $user ) {
  $block_these_roles = array(
    'administrator',
    'editor',
    'author',
    'contributor',
    'subscriber'
  );
	
  $vars = get_object_vars( $user );
  if ( is_array( $vars['caps'] ) ) {
    foreach ( array_keys( $vars['caps'] ) as $role ) {
      if ( in_array( $role, $block_these_roles, true ) ) {
        $do_index = false;
        break;
      }
    }
  }
  
  return $do_index;
}

Just adjust the $block_these_roles array to include the roles you want to exclude from the index.

Your account

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

Search

Popular Resources

Relevanssi indexes excluded posts

…theme search is not using Relevanssi for some reason. Common causes for indexing the wrong post types The most common reason for index including the wrong post type is a shortcode or some other feature that displays posts and confuses Relevanssi. In the case that prompted this post, the search…confused Relevanssi and when Relevanssi indexed the page, the post changed in the middle and the wrong post ended up in the index. Something like this is the most common cause for the wrong post type ending up in the index. Fixing the problem In this case the solution was…

Effect of Relevanssi on page speed

…a pretty wrapper for curl which hits the front page 20 times in row, making multiple requests every time and averaging the times. The results With Relevanssi enabled, the front page loading time averages ranged from 0.161 to 0.187 seconds. With Relevanssi disabled, the loading times were slightly faster: from……It has about 9,000 posts. The wp_posts database table is about 128 megabytes, with another 10 megabytes in indices, while the wp_relevanssi table is hefty 270 megabytes, with 400 megabytes of indices (this ratio of Relevanssi taking almost five times as much space as the actual posts is fairly typical.)……and the speeds varied from 0.154 to 0.177 seconds. No noticeable difference there. Based on this, I think it’s safe to say having a big Relevanssi database table has no effect on site loading times. If you do notice a difference on your site, that would suggest there’s something wrong….

Can Relevanssi access content outside WordPress?

…and so on. Those functions cannot access anything outside the WordPress installation, whether it’s another WordPress installation, HTML files or external databases. If you still need this… If you really must have Relevanssi access outside data, there’s one way to achieve that: import the data inside your WordPress installation. Create…Short answer: no. Relevanssi can only access WordPress content. For a longer answer, read on. Only within single WP installation Relevanssi only operates within one WordPress installation. Relevanssi Premium supports multisite searching, where the search can return posts from more than one subsite at once, but even in those cases……the WordPress sites must be part of the same installation. It’s not possible to search content that exists in another WordPress installation, not even if it’s on the same server. No outside content Relevanssi is heavily dependent on WordPress methods. When getting posts, Relevanssi uses the get_post() function in WordPress…

Related Posts:

Comment Section:

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