arm_before_update_custom_access_rules

This Filter applied to custom access rule array, prior to saving to the database.

Hook Type: Filter
Usage:
add_filter( 'arm_before_update_custom_access_rules', 'your_function', 10, 3);
function your_function($custom_rules = array(), $type_slug, $arm_rules) {
    //$custom_rules Array of old custom rules.
    //$type_slug Access Rule Type.
    //$arm_rules New Access Rules.
    if ($type_slug == 'custom_rule') {
        foreach ($arm_rules as $item_id => $item_rule) {
            $item_rule = (array) $item_rule;
            if (empty($item_rule['protection']) || $item_rule['protection'] == '0') {
                unset($item_rule['plans']);
            } else {
                $item_rule['plans'] = (array) $item_rule['plans'];
                $item_rule['plans'] = array_keys($item_rule['plans']);
            }
            $custom_rules['custom_rule'][$item_id] = $item_rule;
	}
    }
    return $custom_rules;
}
Parameters:
$custom_rules
Array of old custom rules
$type_slug
Access Rule Type
$arm_rules
New Access Rules