Yoast\WP\SEO\Builders

Indexable_Hierarchy_Builder::get_indexable_id()privateYoast 1.0

Returns the ID for an indexable. Catches situations where the id is null due to errors.

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

Хуков нет.

Возвращает

Строку|int. A unique ID for the indexable.

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

// private - только в коде основоного (родительского) класса
$result = $this->get_indexable_id( $indexable );
$indexable(Indexable) (обязательный)
The indexable.

Код Indexable_Hierarchy_Builder::get_indexable_id() Yoast 22.3

private function get_indexable_id( Indexable $indexable ) {
	if ( $indexable->id === 0 ) {
		return "{$indexable->object_type}:{$indexable->object_id}";
	}

	return $indexable->id;
}