Yoast\WP\SEO\Abilities\Infrastructure
Term_Identifier_Resolver::resolve_one
Resolves the input to exactly one term indexable.
Метод класса: Term_Identifier_Resolver{}
Хуков нет.
Возвращает
Indexable|WP_Error. The matching indexable, or an error (missing or unknown identifier).
Использование
$Term_Identifier_Resolver = new Term_Identifier_Resolver(); $Term_Identifier_Resolver->resolve_one( $input );
- $input(array<string, int|строка|true|false|null>) (обязательный)
- The input containing one of
'term_id'or'permalink'.
Код Term_Identifier_Resolver::resolve_one() Term Identifier Resolver::resolve one Yoast 28.9
public function resolve_one( array $input ) {
if ( $this->has( $input, 'term_id' ) ) {
return $this->by_id( (int) $input['term_id'] );
}
if ( $this->has( $input, 'permalink' ) ) {
return $this->by_permalink( (string) $input['permalink'] );
}
return new WP_Error(
'yoast_seo_missing_identifier',
\__( 'Provide a term_id or a permalink to identify the term.', 'wordpress-seo' ),
[ 'status' => 400 ],
);
}