Yoast\WP\SEO\Commands

Index_Command::clear()protectedYoast 1.0

Clears the database related to the indexables.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->clear();

Код Index_Command::clear() Yoast 22.4

protected function clear() {
	global $wpdb;

	// For the PreparedSQLPlaceholders issue, see: https://github.com/WordPress/WordPress-Coding-Standards/issues/1903.
	// For the DirectDBQuery issue, see: https://github.com/WordPress/WordPress-Coding-Standards/issues/1947.
	// phpcs:disable WordPress.DB -- Table names should not be quoted and truncate queries can not be cached.
	$wpdb->query(
		$wpdb->prepare(
			'TRUNCATE TABLE %1$s',
			Model::get_table_name( 'Indexable' )
		)
	);
	$wpdb->query(
		$wpdb->prepare(
			'TRUNCATE TABLE %1$s',
			Model::get_table_name( 'Indexable_Hierarchy' )
		)
	);
	// phpcs:enable
}