Yoast\WP\SEO\Repositories

Indexable_Cleanup_Repository::count_indexables_for_non_publicly_viewable_post()publicYoast 1.0

Counts all indexables for non public post types.

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

Хуков нет.

Возвращает

float|int.

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

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

Код Indexable_Cleanup_Repository::count_indexables_for_non_publicly_viewable_post() Yoast 23.4

public function count_indexables_for_non_publicly_viewable_post() {
	$included_post_types = $this->post_type->get_indexable_post_types();

	if ( empty( $included_post_types ) ) {
		return $this
			->query()
			->where( 'object_type', 'post' )
			->where_not_equal( 'object_sub_type', 'null' )
			->count();
	}
	else {
		return $this
			->query()
			->where( 'object_type', 'post' )
			->where_not_equal( 'object_sub_type', 'null' )
			->where_not_in( 'object_sub_type', $included_post_types )
			->count();
	}
}