Yoast\WP\SEO\Repositories

Indexable_Cleanup_Repository::count_indexables_for_non_publicly_post_type_archive_pages()publicYoast 1.0

Counts indexables for non publicly viewable taxonomies.

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

Хуков нет.

Возвращает

float|int.

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

$Indexable_Cleanup_Repository = new Indexable_Cleanup_Repository();
$Indexable_Cleanup_Repository->count_indexables_for_non_publicly_post_type_archive_pages();

Код Indexable_Cleanup_Repository::count_indexables_for_non_publicly_post_type_archive_pages() Yoast 23.4

public function count_indexables_for_non_publicly_post_type_archive_pages() {
	$included_post_types = $this->post_type->get_indexable_post_archives();

	$post_archives = [];

	foreach ( $included_post_types as $post_type ) {
		$post_archives[] = $post_type->name;
	}
	if ( empty( $post_archives ) ) {
		return $this
			->query()
			->where( 'object_type', 'post-type-archive' )
			->where_not_equal( 'object_sub_type', 'null' )
			->count();
	}

	return $this
		->query()
		->where( 'object_type', 'post-type-archive' )
		->where_not_equal( 'object_sub_type', 'null' )
		->where_not_in( 'object_sub_type', $post_archives )
		->count();
}