Yoast\WP\SEO\Abilities\Infrastructure

Author_Schema_Field_Map::validate_pronouns │ public │ Yoast 1.0

Validates that the pronouns can be set: the user profile page only shows the pronouns, and saves them, when author archives are enabled and to users who can edit other users.

Метод класса: Author_Schema_Field_Map{}

Хуков нет.

Возвращает

string|null. A warning when the value cannot be saved, null otherwise.

Использование

$Author_Schema_Field_Map = new Author_Schema_Field_Map();
$Author_Schema_Field_Map->validate_pronouns( $value, $field_name ): ?string;
$value(разное) (обязательный)
The value to save.
$field_name(строка) (обязательный)
The name of the field.

Код Author_Schema_Field_Map::validate_pronouns() Yoast 28.9

public function validate_pronouns( $value, string $field_name ): ?string {
	if ( ! $this->author_pronouns->is_setting_enabled() ) {
		return \sprintf(
			/* translators: %s expands to the name of a setting. */
			\__( 'The %s setting was not changed, because author archives are disabled on this site.', 'wordpress-seo' ),
			$field_name,
		);
	}

	// Like on the user profile page, which only shows the pronouns to users who can edit other users.
	if ( ! $this->user_can_edit_users_conditional->is_met() ) {
		return \sprintf(
			/* translators: %s expands to the name of a setting. */
			\__( 'The %s setting was not changed, because only users who can edit other users can change it.', 'wordpress-seo' ),
			$field_name,
		);
	}

	return null;
}