plugin updates
This commit is contained in:
@@ -112,32 +112,30 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* description
|
||||
* AJAX handler for getting Select field choices.
|
||||
*
|
||||
* @type function
|
||||
* @date 24/10/13
|
||||
* @since 5.0.0
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param $post_id (int)
|
||||
* @return $post_id (int)
|
||||
* @return void
|
||||
*/
|
||||
function ajax_query() {
|
||||
public function ajax_query() {
|
||||
$nonce = acf_request_arg( 'nonce', '' );
|
||||
$key = acf_request_arg( 'field_key', '' );
|
||||
|
||||
// validate
|
||||
if ( ! acf_verify_ajax() ) {
|
||||
// Back-compat for field settings.
|
||||
if ( ! acf_is_field_key( $key ) ) {
|
||||
$nonce = '';
|
||||
$key = '';
|
||||
}
|
||||
|
||||
if ( ! acf_verify_ajax( $nonce, $key ) ) {
|
||||
die();
|
||||
}
|
||||
|
||||
// get choices
|
||||
$response = $this->get_ajax_query( $_POST );
|
||||
|
||||
// return
|
||||
acf_send_ajax_results( $response );
|
||||
acf_send_ajax_results( $this->get_ajax_query( $_POST ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This function will return an array of data formatted for use in a select2 AJAX response
|
||||
*
|
||||
@@ -292,7 +290,12 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
||||
if ( ! empty( $field['ajax_action'] ) ) {
|
||||
$select['data-ajax_action'] = $field['ajax_action'];
|
||||
}
|
||||
|
||||
if ( ! empty( $field['nonce'] ) ) {
|
||||
$select['data-nonce'] = $field['nonce'];
|
||||
}
|
||||
if ( $field['ajax'] && empty( $field['nonce'] ) && acf_is_field_key( $field['key'] ) ) {
|
||||
$select['data-nonce'] = wp_create_nonce( $field['key'] );
|
||||
}
|
||||
if ( ! empty( $field['hide_search'] ) ) {
|
||||
$select['data-minimum-results-for-search'] = '-1';
|
||||
}
|
||||
@@ -307,10 +310,6 @@ if ( ! class_exists( 'acf_field_select' ) ) :
|
||||
);
|
||||
}
|
||||
|
||||
if ( ! empty( $field['query_nonce'] ) ) {
|
||||
$select['data-query-nonce'] = $field['query_nonce'];
|
||||
}
|
||||
|
||||
// append
|
||||
$select['value'] = $value;
|
||||
$select['choices'] = $choices;
|
||||
|
||||
Reference in New Issue
Block a user