acf_admin_field_group::ajax_render_location_rulepublicACF 5.0.0

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() code ACF 6.0.4

public function ajax_render_location_rule() {

	// validate.
	if ( ! acf_verify_ajax() ) {
		die();
	}

	// verify user capability.
	if ( ! acf_current_user_can_admin() ) {
		die();
	}

	// validate rule.
	$rule = acf_validate_location_rule( acf_sanitize_request_args( $_POST['rule'] ) );

	// view.
	acf_get_view(
		'html-location-rule',
		array(
			'rule' => $rule,
		)
	);

	// die.
	die();
}