diff --git a/php/integrations/yoast.php b/php/integrations/yoast.php index 938a9277..8807e6f4 100644 --- a/php/integrations/yoast.php +++ b/php/integrations/yoast.php @@ -11,6 +11,7 @@ use Yoast\WP\SEO\Generators\Schema\Abstract_Schema_Piece; use Yoast\WP\SEO\Presentations\Indexable_Author_Archive_Presentation; use WP_User; +use function __; /** * The main Yoast integration class @@ -256,7 +257,7 @@ public static function filter_slack_data( $data, $presentation ): array { } $output = self::get_authors_display_names_output( $author_objects ); - $data[ \__( 'Written by', 'co-authors-plus' ) ] = $output; + $data[ __( 'Written by', 'co-authors-plus' ) ] = $output; return $data; } @@ -339,7 +340,7 @@ public static function fix_guest_author_archive_url_presenter( $url, $presenter * @return array Modified $replacements. */ public static function filter_author_name_variable( $replacements, $args ): array { - if ( isset( $replacements['%%name%%'], $args->ID ) ) { + if ( isset( $replacements['%%name%%'], $args->ID ) && is_single() ) { $author_objects = get_coauthors( $args->ID ); // Fallback in case of error.