WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Yoast\WP\SEO\Builders

Indexable_Builder::build_for_id_and_type() public Yoast 1.0

Creates an indexable by its ID and type.

{} Это метод класса: Indexable_Builder{}

Хуков нет.

Возвращает

true/false/Indexable. Instance of indexable. False when unable to build.

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

$Indexable_Builder = new Indexable_Builder();
$Indexable_Builder->build_for_id_and_type( $object_id, $object_type, $indexable );
$object_id(число) (обязательный)
The indexable object ID.
$object_type(строка) (обязательный)
The indexable object type.
$indexable(Indexable/true/false)
An existing indexable to overwrite.
По умолчанию: false

Код Indexable_Builder::build_for_id_and_type() Yoast 15.7

<?php
public function build_for_id_and_type( $object_id, $object_type, $indexable = false ) {
	$indexable        = $this->ensure_indexable( $indexable );
	$indexable_before = $this->indexable_repository
		->query()
		->create( $indexable->as_array() );

	try {
		switch ( $object_type ) {
			case 'post':
				$indexable = $this->post_builder->build( $object_id, $indexable );
				if ( $indexable === false ) {
					// Post was not built for a reason, for example if its post type is excluded.
					return $indexable;
				}

				$this->primary_term_builder->build( $object_id );

				$author = $this->indexable_repository->find_by_id_and_type( $indexable->author_id, 'user', false );
				if ( ! $author ) {
					$this->build_for_id_and_type( $indexable->author_id, 'user' );
				}

				break;
			case 'user':
				$indexable = $this->author_builder->build( $object_id, $indexable );
				break;
			case 'term':
				$indexable = $this->term_builder->build( $object_id, $indexable );
				break;
			default:
				return $indexable;
		}
	}
	catch ( Source_Exception $exception ) {
		$indexable = $this->indexable_repository->query()->create(
			[
				'object_id'   => $object_id,
				'object_type' => $object_type,
				'post_status' => 'unindexed',
			]
		);
	}

	$indexable = $this->save_indexable( $indexable, $indexable_before );

	if ( \in_array( $object_type, [ 'post', 'term' ], true ) && $indexable->post_status !== 'unindexed' ) {
		$this->hierarchy_builder->build( $indexable );
	}

	return $indexable;
}