ACF_Field_User::ajax_query_init
Runs during the AJAX query initialization.
Метод класса: ACF_Field_User{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$ACF_Field_User = new ACF_Field_User(); $ACF_Field_User->ajax_query_init( $request, $query );
- $request(массив) (обязательный)
- The query request.
- $query(ACF_Ajax_Query) (обязательный)
- The query object.
Список изменений
| С версии 5.8.8 | Введена. |
Код ACF_Field_User::ajax_query_init() ACF Field User::ajax query init ACF 6.4.2
function ajax_query_init( $request, $query ) {
// Require field and make sure it's a user field.
if ( ! $query->field || $query->field['type'] !== $this->name ) {
$query->send( new WP_Error( 'acf_missing_field', __( 'Error loading field.', 'acf' ), array( 'status' => 404 ) ) );
}
// Verify that this is a legitimate request using a separate nonce from the main AJAX nonce.
$nonce = acf_request_arg( 'nonce', '' );
$key = acf_request_arg( 'field_key', '' );
if ( ! acf_verify_ajax( $nonce, $key, true ) ) {
$query->send( new WP_Error( 'acf_invalid_request', __( 'Invalid request.', 'acf' ), array( 'status' => 404 ) ) );
}
}