Yoast\WP\SEO\Abilities\User_Interface
Abilities_Integration::get_post_seo_data_output_schema
Returns the output schema describing a post's SEO data.
Метод класса: Abilities_Integration{}
Хуков нет.
Возвращает
Массив<Строку,. mixed> The output schema.
Использование
// private - только в коде основоного (родительского) класса $result = $this->get_post_seo_data_output_schema(): array;
Код Abilities_Integration::get_post_seo_data_output_schema() Abilities Integration::get post seo data output schema Yoast 28.2
private function get_post_seo_data_output_schema(): array {
$nullable_string = [
'type' => [ 'string', 'null' ],
];
$score = static function ( $analysis ) {
return [
'type' => 'string',
'enum' => [ 'na', 'bad', 'ok', 'good' ],
'description' => \sprintf(
/* translators: %s expands to the name of the analysis, e.g. "SEO analysis". */
\__( 'The result of the %s that ran on the post when it was last saved.', 'wordpress-seo' ),
$analysis,
),
];
};
// The rendered companion of a field carries the value as actually output on the front end: the global default template applied where no custom value is set, with replacement variables expanded.
$rendered = static function ( $field ) {
return [
'type' => [ 'string', 'null' ],
'description' => \sprintf(
/* translators: %s expands to the name of the SEO field, e.g. "SEO title". */
\__( 'The %s as output on the front end: the global default template applied when no custom value is set, with replacement variables expanded. Null when nothing is output.', 'wordpress-seo' ),
$field,
),
];
};
return [
'type' => 'object',
'properties' => [
'post_id' => [ 'type' => 'integer' ],
'post_title' => $nullable_string,
'permalink' => $nullable_string,
'post_type' => [ 'type' => 'string' ],
'post_status' => $nullable_string,
'seo_title' => $nullable_string,
'seo_title_rendered' => $rendered( \__( 'SEO title', 'wordpress-seo' ) ),
'meta_description' => $nullable_string,
'meta_description_rendered' => $rendered( \__( 'meta description', 'wordpress-seo' ) ),
'focus_keyphrase' => $nullable_string,
'canonical' => $nullable_string,
'canonical_rendered' => $rendered( \__( 'canonical URL', 'wordpress-seo' ) ),
'is_cornerstone' => [ 'type' => 'boolean' ],
'noindex' => [
'type' => [ 'boolean', 'null' ],
'description' => \__( 'Whether search engines are told not to index this post. true means noindex (the post is excluded from search results); false means the post is forced to be indexed; null means no setting is stored and the post-type default applies.', 'wordpress-seo' ),
],
'nofollow' => [ 'type' => 'boolean' ],
'noimageindex' => [ 'type' => 'boolean' ],
'noarchive' => [ 'type' => 'boolean' ],
'nosnippet' => [ 'type' => 'boolean' ],
'open_graph_title' => $nullable_string,
'open_graph_title_rendered' => $rendered( \__( 'Open Graph title', 'wordpress-seo' ) ),
'open_graph_description' => $nullable_string,
'open_graph_description_rendered' => $rendered( \__( 'Open Graph description', 'wordpress-seo' ) ),
'twitter_title' => $nullable_string,
'twitter_title_rendered' => $rendered( \__( 'Twitter title', 'wordpress-seo' ) ),
'twitter_description' => $nullable_string,
'twitter_description_rendered' => $rendered( \__( 'Twitter description', 'wordpress-seo' ) ),
'schema_page_type' => $nullable_string,
'schema_article_type' => $nullable_string,
'seo_score' => $score( \__( 'SEO analysis', 'wordpress-seo' ) ),
'readability_score' => $score( \__( 'readability analysis', 'wordpress-seo' ) ),
'inclusive_language_score' => $score( \__( 'inclusive language analysis', 'wordpress-seo' ) ),
],
];
}