jetpack_forms_enable_ajax_submission

jetpack_forms_enable_ajax_submission

Appears in:
Hook Type: filter

See hook in core

Displaying hooks found in version: jetpack.14.8

apply_filters('jetpack_forms_enable_ajax_submission') is found 2 times:

  • /jetpack_vendor/automattic/jetpack-forms/src/contact-form/class-contact-form.php line 437
    				'showErrors'              => false, // We toggle this to true when we want to show the user errors right away.
    				'errors'                  => array(), // This should be a associative array.
    				'fields'                  => array(),
    				'isMultiStep'             => $is_multistep, // Whether the form is a multistep form.
    				'isAjaxSubmissionEnabled' => apply_filters( 'jetpack_forms_enable_ajax_submission', false ),
    			);
    
    			if ( $is_multistep ) {
    				$multistep_context = array(
    					'currentStep' => isset( $_GET[ $id . '-step' ] ) ? absint( $_GET[ $id . '-step' ] ) : 1,
    					'maxSteps'    => $max_steps,
    
  • /jetpack_vendor/automattic/jetpack-forms/src/contact-form/class-contact-form.php line 1885
    		 */
    		do_action( 'grunion_after_message_sent', $post_id, $to, $subject, $message, $headers, $all_values, $extra_values );
    
    		// If the request accepts JSON, return a JSON response instead of redirecting
    		$is_ajax_submission_enabled = apply_filters( 'jetpack_forms_enable_ajax_submission', false );
    		$accepts_json               = isset( $_SERVER['HTTP_ACCEPT'] ) && false !== strpos( strtolower( sanitize_text_field( wp_unslash( $_SERVER['HTTP_ACCEPT'] ) ) ), 'application/json' );
    
    		if ( $is_ajax_submission_enabled && $accepts_json ) {
    			header( 'Content-Type: application/json' );
    
    			echo wp_json_encode(