apply_filters( 'relevanssi_user_profile_to_post', object $post )

This filter hook lets you modify post objects Relevanssi Premium creates from user profiles.


(object) The post object from the user profile.

More information

When Relevanssi Premium searches user profiles, it needs to create posts, as search results templates want to see posts. This conversion happens in relevanssi_premium_get_post(), and you can use this filter hook to adjust the post object created in the process.

The objects are not WP_Post objects but look like them. The user display name is stored in $post->post_title, $post->post_content has the user description. $post->relevanssi_link has the author posts URL from get_author_posts_url(). $post->post_type is set to “user” and the user ID is stored both in $post->ID and $post->user_id. The post status for users is “publish“, $post->post_date is set to the current time and $post->post_author is set to 0.

You can modify all these values with this filter hook.