Yoast\WP\SEO\Helpers

Indexing_Helper::get_unindexed_percentage()publicYoast 1.0

Returns the amount of un-indexed posts expressed in percentage, which will be needed to set a threshold.

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

Хуков нет.

Возвращает

int. The amount of unindexed posts expressed in percentage.

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

$Indexing_Helper = new Indexing_Helper();
$Indexing_Helper->get_unindexed_percentage( $unindexed_count );
$unindexed_count(int) (обязательный)
The number of unindexed objects.

Код Indexing_Helper::get_unindexed_percentage() Yoast 19.11

public function get_unindexed_percentage( $unindexed_count ) {
	// Gets the amount of indexed objects in the site.
	$indexed_count = $this->indexable_repository->get_total_number_of_indexables();
	// The total amount of objects in the site.
	$total_objects_count = ( $indexed_count + $unindexed_count );

	return ( ( $unindexed_count / $total_objects_count ) * 100 );
}