acf_form_front::submit_form()publicACF 5.5.10

submit_form

This function will submit form data

@type    function

{} Это метод класса: acf_form_front{}

Возвращает

null. Ничего.

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

$acf_form_front = new acf_form_front();
$acf_form_front->submit_form( $form );
$form (обязательный)
-

Список изменений

С версии 5.5.10 Введена.

Код acf_form_front::submit_form() ACF 5.10.2

function submit_form( $form ) {

	// filter
	$form = apply_filters( 'acf/pre_submit_form', $form );

	// vars
	$post_id = acf_maybe_get( $form, 'post_id', 0 );

	// add global for backwards compatibility
	$GLOBALS['acf_form'] = $form;

	// allow for custom save
	$post_id = apply_filters( 'acf/pre_save_post', $post_id, $form );

	// save
	acf_save_post( $post_id );

	// restore form (potentially modified)
	$form = $GLOBALS['acf_form'];

	// action
	do_action( 'acf/submit_form', $form, $post_id );

	// vars
	$return = acf_maybe_get( $form, 'return', '' );

	// redirect
	if ( $return ) {

		// update %placeholders%
		$return = str_replace( '%post_id%', $post_id, $return );
		$return = str_replace( '%post_url%', get_permalink( $post_id ), $return );

		// redirect
		wp_redirect( $return );
		exit;

	}

}