Support » Plugin: Co-Authors Plus » Plugin Breaks Titles Generated via get_the_archive_title() Hook

  • tkiehne

    (@tkiehne)


    The current implementation doesn’t handle the get_the_archive_title() hook correctly in WP 5.x. The callback is supposed to take an argument containing the current title string then modify or pass it through as desired.

    Expected behavior: only author archive titles will be altered by the plugin; all other archive titles will remain intact.

    Current behavior: all archive titles except author archive titles are nulled-out by the plugin.

    I created a patch that fixes the problem; contact me if there is a better way to contribute:

    --- co-authors-plus/co-authors-plus.php	Wed Apr 17 21:31:59 2019
    +++ co-authors-plus/co-authors-plus-fixed.php	Wed Apr 17 21:31:44 2019
    @@ -1618,11 +1618,13 @@
     	/**
     	 * Filter of the header of author archive pages to correctly display author.
     	 */
    -	public function filter_author_archive_title() {
    +	public function filter_author_archive_title($orig) {
     		if ( is_author() ) {
     			$author = sanitize_user( get_query_var( 'author_name' ) );
     			return "Author: ". $author;
     		}
    +
    +		return $orig;
     	}
     }
     
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.