WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Авторские Темы для WordPress
функция не описана

wpcf7_rest_create_feedback() CF7 1.0

Хуки из функции
Возвращает

null. Ничего.

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

wpcf7_rest_create_feedback( $request );
$request(WP_REST_Request) (обязательный)
-

Код wpcf7_rest_create_feedback() CF7 5.4.1

<?php
function wpcf7_rest_create_feedback( WP_REST_Request $request ) {
	$url_params = $request->get_url_params();

	$item = null;

	if ( ! empty( $url_params['id'] ) ) {
		$item = wpcf7_contact_form( $url_params['id'] );
	}

	if ( ! $item ) {
		return new WP_Error( 'wpcf7_not_found',
			__( "The requested contact form was not found.", 'contact-form-7' ),
			array( 'status' => 404 )
		);
	}

	$result = $item->submit();

	$unit_tag = $request->get_param( '_wpcf7_unit_tag' );

	$response = array(
		'into' => '#' . wpcf7_sanitize_unit_tag( $unit_tag ),
		'status' => $result['status'],
		'message' => $result['message'],
		'posted_data_hash' => $result['posted_data_hash'],
	);

	if ( 'validation_failed' == $result['status'] ) {
		$invalid_fields = array();

		foreach ( (array) $result['invalid_fields'] as $name => $field ) {
			$invalid_fields[] = array(
				'into' => 'span.wpcf7-form-control-wrap.'
					. sanitize_html_class( $name ),
				'message' => $field['reason'],
				'idref' => $field['idref'],
				'error_id' => sprintf(
					'%1$s-ve-%2$s',
					$unit_tag,
					$name
				),
			);
		}

		$response['invalid_fields'] = $invalid_fields;
	}

	$response = wpcf7_apply_filters_deprecated(
		'wpcf7_ajax_json_echo',
		array( $response, $result ),
		'5.2',
		'wpcf7_feedback_response'
	);

	$response = apply_filters( 'wpcf7_feedback_response', $response, $result );

	return rest_ensure_response( $response );
}