ap_ajax_responce( array|string $results )
Description #
Format an array as valid AnsPress ajax response.
Parameters #
- $resultsarray | string (Required) Response to send.
Source #
File: includes/functions.php
function ap_ajax_responce( $results ) { if ( ! is_array( $results ) ) { $message_id = $results; $results = array(); $results['message'] = $message_id; } $results['ap_responce'] = true; if ( isset( $results['message'] ) ) { $error_message = ap_response_message( $results['message'] ); if ( false !== $error_message ) { $results['snackbar'] = array( 'message' => $error_message['message'], 'message_type' => $error_message['type'], ); $results['success'] = 'error' === $error_message['type'] ? false : true; } } /** * Filter AnsPress ajax response body. * * @param array $results Results. * @since 2.0.1 */ $results = apply_filters( 'ap_ajax_responce', $results ); return $results; }
Expand full source code Collapse full source code View on GitHub: includes/functions.php:588
Add your comment