Yoast\WP\SEO\Bulk_Editor\Infrastructure\Posts

Post_Editability_Resolver::resolvepublicYoast 1.0

Returns, for each given post ID, whether the current user may edit it.

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

Хуков нет.

Возвращает

Массив. bool> A map of post ID to whether the current user may edit it.

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

$Post_Editability_Resolver = new Post_Editability_Resolver();
$Post_Editability_Resolver->resolve( $post_ids ): array;
$post_ids(array) (обязательный)
The post IDs on the current page.

Код Post_Editability_Resolver::resolve() Yoast 28.3

public function resolve( array $post_ids ): array {
	if ( $post_ids === [] ) {
		return [];
	}

	// Prime the post cache once so the per-post edit check does not run a query per post.
	\_prime_post_caches( $post_ids, false, false );

	$editability = [];
	foreach ( $post_ids as $post_id ) {
		$editability[ $post_id ] = $this->post_access_checker->can_edit( $post_id );
	}

	return $editability;
}