acf_validate_location_rule()
Returns a validated location rule with all props.
Hooks from the function
Returns
Array.
Usage
acf_validate_location_rule( $rule );
- $rule(array)
- The location rule.
Default:array()
Changelog
| Since 5.9.0 | Introduced. |
acf_validate_location_rule() acf validate location rule code ACF 6.0.4
function acf_validate_location_rule( $rule = array() ) {
// Apply defaults.
$rule = wp_parse_args(
$rule,
array(
'id' => '',
'group' => '',
'param' => '',
'operator' => '==',
'value' => '',
)
);
/**
* Filters the location rule to ensure is valid.
*
* @date 8/4/20
* @since 5.9.0
*
* @param array $rule The location rule.
*/
$rule = apply_filters( "acf/location/validate_rule/type={$rule['param']}", $rule );
$rule = apply_filters( 'acf/location/validate_rule', $rule );
return $rule;
}