Yoast\WP\SEO\Abilities\Infrastructure
Site_Representation_Field_Validators::validate_company_or_person
Validates the represented entity type.
Local SEO forces the site to represent an organization when reading the option, so writing "person" would be undone right away and reported as a failed save.
Метод класса: Site_Representation_Field_Validators{}
Хуков нет.
Возвращает
string|null. A warning when the value cannot be saved, null otherwise.
Использование
$Site_Representation_Field_Validators = new Site_Representation_Field_Validators(); $Site_Representation_Field_Validators->validate_company_or_person( $value ): ?string;
- $value(разное) (обязательный)
- The value to save.
Код Site_Representation_Field_Validators::validate_company_or_person() Site Representation Field Validators::validate company or person Yoast 28.8
public function validate_company_or_person( $value ): ?string {
if ( $value !== 'person' || ! $this->local_seo_active_conditional->is_met() ) {
return null;
}
return \sprintf(
/* translators: %s expands to Yoast Local SEO. */
\__( 'The site was not set to represent a person, because %s is active and requires the site to represent an organization.', 'wordpress-seo' ),
'Yoast Local SEO',
);
}