acf_admin_field_group::ajax_render_location_rule
This function can be accessed via an AJAX action and will return the result from the render_location_value function
Method of the class: acf_admin_field_group{}
No Hooks.
Returns
null. Nothing (null).
Usage
$acf_admin_field_group = new acf_admin_field_group(); $acf_admin_field_group->ajax_render_location_rule();
Changelog
| Since 5.0.0 | Introduced. |
acf_admin_field_group::ajax_render_location_rule() acf admin field group::ajax render location rule code ACF 6.8.8
public function ajax_render_location_rule() {
// validate.
if ( ! acf_verify_ajax() ) {
die();
}
// verify user capability.
if ( ! acf_current_user_can_admin() ) {
die();
}
if ( empty( $_POST['rule'] ) ) {
die();
}
// validate rule.
$rule = acf_validate_location_rule( acf_sanitize_request_args( $_POST['rule'] ) ); //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash -- values not saved.
acf_get_view(
'acf-field-group/location-rule',
array(
'rule' => $rule,
)
);
die();
}