Yoast\WP\SEO\Abilities\Infrastructure
Term_Identifier_Resolver::by_permalink
Resolves a term by its permalink.
Matches the permalink exactly against the indexable table; no WordPress URL resolution is performed, so the exact stored permalink must be provided.
Метод класса: Term_Identifier_Resolver{}
Хуков нет.
Возвращает
Indexable|WP_Error. The matching indexable, or a not-found error.
Использование
// private - только в коде основоного (родительского) класса $result = $this->by_permalink( $permalink );
- $permalink(строка) (обязательный)
- The permalink.
Код Term_Identifier_Resolver::by_permalink() Term Identifier Resolver::by permalink Yoast 28.9
private function by_permalink( string $permalink ) {
$indexable = $this->indexable_repository->find_by_permalink( $permalink );
// The permalink lookup is not scoped by object type, so a post, author, or
// archive URL can match too; only terms are valid targets here.
if ( ! $indexable || $indexable->object_type !== 'term' ) {
return $this->invalid_identifier( 'permalink' );
}
return $indexable;
}