Yoast\WP\SEO\Abilities\Infrastructure
Post_Identifier_Resolver::invalid_identifier
Builds the error for an identifier that does not resolve to a post.
Coded yoast_seo_invalid_<field> so a caller knows which identifier to correct and retry.
Метод класса: Post_Identifier_Resolver{}
Хуков нет.
Возвращает
WP_Error. The error for the unresolvable identifier.
Использование
// private - только в коде основоного (родительского) класса $result = $this->invalid_identifier( $field ): WP_Error;
- $field(строка) (обязательный)
- The identifier that failed to resolve:
'post_id','permalink', or'title'.
Код Post_Identifier_Resolver::invalid_identifier() Post Identifier Resolver::invalid identifier Yoast 28.3
private function invalid_identifier( string $field ): WP_Error {
return new WP_Error(
'yoast_seo_invalid_' . $field,
\__( 'No post could be found for the given identifier.', 'wordpress-seo' ),
[ 'status' => 404 ],
);
}