apply_filters( 'relevanssi_post_author', string $display_name, WP_Post $post )

Filters the post author display_name before it is indexed by Relevanssi.


(string) The author display_name.

(WP_Post) The post object.

More information

When you set Relevanssi to index the post author, Relevanssi gets the author display_name value and indexes that. If you want to modify the value somehow, or perhaps use a different value from the author user profile, you can use this filter hook.

For example, to avoid indexing the author for the news post type, while indexing it for the other post types, you could do this:

add_filter( 'relevanssi_post_author', 'rlv_no_author_for_news', 10, 2 );
function rlv_no_author_for_news( $post_author, $post ) {
  if ( 'news' === $post->post_type ) {
    $post_author = '';
  return $post_author;

If you want to get access to the post author, you can find the author ID in $post->post_author.