Yoast\WP\SEO\Repositories

Indexable_Repository::find_by_permalink()publicYoast 1.0

Retrieves an indexable by its permalink.

Метод класса: Indexable_Repository{}

Хуков нет.

Возвращает

true|false|Indexable. The indexable, false if none could be found.

Использование

$Indexable_Repository = new Indexable_Repository();
$Indexable_Repository->find_by_permalink( $permalink );
$permalink(строка) (обязательный)
The indexable permalink.

Код Indexable_Repository::find_by_permalink() Yoast 22.4

public function find_by_permalink( $permalink ) {
	$permalink_hash = \strlen( $permalink ) . ':' . \md5( $permalink );

	// Find by both permalink_hash and permalink, permalink_hash is indexed so will be used first by the DB to optimize the query.
	return $this->query()
		->where( 'permalink_hash', $permalink_hash )
		->where( 'permalink', $permalink )
		->find_one();
}