Your cart is empty!
Load Rules
do_action_ref_array( 'vikrestaurants_load_custom_fields_rules', array &$rules )
Fires while loading the list of supported custom fields rules.
Description
Trigger hook to allow external plugins to support additional rules for the custom fields.
New rules have to be appended to the given associative array. The key of the array is the unique ID of the rule, the value is a readable name of the rule.
All the values included within the $rules array will be reported as accepted options of the Rule dropdown under the management page of a custom field.
Parameters
- &$rules
-
(array) An associative array holding all the supported rules.
Example
The example below adds support for a new rule that extracts the country code from the field.
/**
* Trigger hook to allow external plugins to support custom rules.
* New rules have to be appended to the given associative array.
* The key of the array is the unique ID of the rule, the value is
* a readable name of the rule.
*
* @param array &$rules An array of rules.
*/
add_action('vikrestaurants_load_custom_fields_rules snippet', function(&$rules) {
// add support for a new "country" rule
$rules['country'] = 'Country';
});
Changelog
Version | Description |
---|---|
1.3 | Introduced. |
Last Update: 2024-01-03
Helpful?