Skip to content
Merged
12 changes: 12 additions & 0 deletions co-authors-plus.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ function __construct() {
add_action( 'save_post', array( $this, 'clear_cache') );
add_action( 'delete_post', array( $this, 'clear_cache') );
add_action( 'set_object_terms', array( $this, 'clear_cache_on_terms_set' ), 10, 6 );

// Filter to correct author on author archive page
add_filter( 'get_the_archive_title', array( $this, 'filter_author_archive_title'), 10, 2 );
}

/**
Expand Down Expand Up @@ -1541,6 +1544,15 @@ public function clear_cache_on_terms_set( $object_id, $terms, $tt_ids, $taxonomy

}

/**
* Filter of the header of author archive pages to correctly display author.
*/
public function filter_author_archive_title() {
if ( is_author() ) {
$author = sanitize_user( get_query_var( 'author_name' ) );
return "Author: ". $author;
}
}
}

global $coauthors_plus;
Expand Down