WPSEO_Upgrade::reset_permalinks_of_attachments_for_141()privateYoast 1.0

Resets the permalinks of attachments to null in the indexable table for the upgrade routine to 14.1.

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

Хуков нет.

Возвращает

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

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

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

Код WPSEO_Upgrade::reset_permalinks_of_attachments_for_141() Yoast 22.1

private function reset_permalinks_of_attachments_for_141() {
	global $wpdb;

	// If migrations haven't been completed succesfully the following may give false errors. So suppress them.
	$show_errors       = $wpdb->show_errors;
	$wpdb->show_errors = false;

	// Reset the permalinks of the attachments in the indexable table.
	$indexable_table = Model::get_table_name( 'Indexable' );
	$query           = "UPDATE $indexable_table SET permalink = NULL WHERE object_type = 'post' AND object_sub_type = 'attachment'";
	$wpdb->query( $query ); // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- Reason: There is no user input.

	$wpdb->show_errors = $show_errors;
}