wpseo_save_all()Yoast 1.0

Utility function to save values.

Хуков нет.

Возвращает

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

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

wpseo_save_all( $what );
$what(строка) (обязательный)
Type of item so save.

Код wpseo_save_all() Yoast 23.8

function wpseo_save_all( $what ) {
	check_ajax_referer( 'wpseo-bulk-editor' );

	$results = [];
	if ( ! isset( $_POST['items'], $_POST['existingItems'] ) ) {
		wpseo_ajax_json_echo_die( $results );
	}

	$new_values      = array_map( [ 'WPSEO_Utils', 'sanitize_text_field' ], wp_unslash( (array) $_POST['items'] ) );
	$original_values = array_map( [ 'WPSEO_Utils', 'sanitize_text_field' ], wp_unslash( (array) $_POST['existingItems'] ) );

	foreach ( $new_values as $post_id => $new_value ) {
		$original_value = $original_values[ $post_id ];
		$results[]      = wpseo_upsert_new( $what, $post_id, $new_value, $original_value );
	}

	wpseo_ajax_json_echo_die( $results );
}