Yoast\WP\SEO\Commands

Cleanup_Command::cleanup_network()privateYoast 1.0

Performs the cleanup for the entire network.

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

Хуков нет.

Возвращает

int. The number of cleaned up records.

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

// private - только в коде основоного (родительского) класса
$result = $this->cleanup_network( $assoc_args );
$assoc_args(массив|null) (обязательный)
The associative arguments.

Код Cleanup_Command::cleanup_network() Yoast 20.0

private function cleanup_network( $assoc_args ) {
	$criteria      = [
		'fields'   => 'ids',
		'spam'     => 0,
		'deleted'  => 0,
		'archived' => 0,
	];
	$blog_ids      = \get_sites( $criteria );
	$total_removed = 0;
	foreach ( $blog_ids as $blog_id ) {
		\switch_to_blog( $blog_id );
		$total_removed += $this->cleanup_current_site( $assoc_args );
		\restore_current_blog();
	}

	return $total_removed;
}