Indexing Profile Builder Pro -generated users

Profile Builder Pro is a fine tool for managing user profiles. However, profiles created by Profile Builder Pro front end forms do not get automatically indexed by Relevanssi. This is because of the user account generation process in Profile Builder Pro doesn’t probably trigger all the filter hooks WP does, and thus Relevanssi doesn’t notice the new users are generated.

Profile Builder Pro has an action hook that can be used to nudge Relevanssi a bit. Just add this code to the theme functions.php, and Relevanssi will notice the new users and will index them:

add_action( 'wppb_register_success', 'rlv_index_wppb_users', 20, 3 );
function rlv_index_wppb_users( $http_request, $form_name, $user_id ){
    relevanssi_index_user($user_id, false);
}