PluginProbe
Yoast SEO – Advanced SEO with real-time guidance and built-in AI / 28.5
Yoast SEO – Advanced SEO with real-time guidance and built-in AI v28.5
28.5 28.4 28.3 28.2 28.1 28.0 27.9 27.8 27.7 27.6 27.5 trunk 18.0 18.1 18.2 18.3 18.4 18.4.1 18.5 18.5.1 18.6 18.7 18.8 18.9 19.0 All 129 releases
← All changes | src/generators/schema/author.php +9 -9 18.428.5 View file →
@@ -1,10 +1,8 @@
1 1 <?php
2 2
3 3 namespace Yoast\WP\SEO\Generators\Schema;
4 4
5 -use Yoast\WP\SEO\Config\Schema_IDs;
6 -
7 5 /**
8 6 * Returns schema Author data.
9 7 */
10 8 class Author extends Person {
@@ -50,9 +48,9 @@
50 48
51 49 // If this is an author page, the Person object is the main object, so we set it as such here.
52 50 if ( $this->context->indexable->object_type === 'user' ) {
53 51 $data['mainEntityOfPage'] = [
54 - '@id' => $this->context->canonical . Schema_IDs::WEBPAGE_HASH,
52 + '@id' => $this->context->main_schema_id,
55 53 ];
56 54 }
57 55
58 56 // If this is a post and the author archives are enabled, set the author archive url as the author url.
@@ -83,9 +81,9 @@
83 81
84 82 /**
85 83 * Filter: 'wpseo_schema_person_user_id' - Allows filtering of user ID used for person output.
86 84 *
87 - * @api int|bool $user_id The user ID currently determined.
85 + * @param int|bool $user_id The user ID currently determined.
88 86 */
89 87 $user_id = \apply_filters( 'wpseo_schema_person_user_id', $user_id );
90 88
91 89 if ( \is_int( $user_id ) && $user_id > 0 ) {
@@ -97,16 +95,18 @@
97 95
98 96 /**
99 97 * An author should not have an image from options, this only applies to persons.
100 98 *
101 - * @param array $data The Person schema.
102 - * @param string $schema_id The string used in the `@id` for the schema.
99 + * @param array $data The Person schema.
100 + * @param string $schema_id The string used in the `@id` for the schema.
101 + * @param bool $add_hash Whether or not the person's image url hash should be added to the image id.
102 + * @param WP_User|null $user_data User data.
103 103 *
104 104 * @return array The Person schema.
105 105 */
106 - protected function set_image_from_options( $data, $schema_id ) {
107 - if ( $this->site_represents_current_author() ) {
108 - return parent::set_image_from_options( $data, $schema_id );
106 + protected function set_image_from_options( $data, $schema_id, $add_hash = false, $user_data = null ) {
107 + if ( $this->site_represents_current_author( $user_data ) ) {
108 + return parent::set_image_from_options( $data, $schema_id, $add_hash, $user_data );
109 109 }
110 110
111 111 return $data;
112 112 }