Filter
uncanny-automator-pro
automator_datetime_conditions_month_days_options
Filters the available day options for month-based datetime conditions, allowing customization of selectable days.
add_filter( 'automator_datetime_conditions_month_days_options', $callback, 10, 1 );
Description
Filters the array of month day options (1-31) available for the "Specific month and day" datetime condition. Developers can modify this array to add, remove, or alter the available day choices for users, influencing how date-based triggers and actions are configured within Uncanny Automator.
Usage
add_filter( 'automator_datetime_conditions_month_days_options', 'your_function_name', 10, 1 );
Parameters
-
$days(mixed) - This parameter contains an array of possible day options for a specific month.
Return Value
The filtered value.
Examples
<?php
/**
* Filters the available day options for a specific month day condition.
*
* This example adds a custom option to exclude the 31st day of any month,
* which might be useful if a recipe should not trigger on months that
* don't have 31 days.
*
* @param array $days An array of day options, each with 'text' and 'value'.
* @return array The modified array of day options.
*/
add_filter( 'automator_datetime_conditions_month_days_options', function( $days ) {
// Example: Remove the 31st day option as a selectable choice.
// This could be useful if you don't want automations to trigger on
// months that don't have 31 days.
$days = array_filter( $days, function( $day_option ) {
return $day_option['value'] !== 31;
} );
// Re-index the array to ensure sequential keys if needed elsewhere
// although in this context, it might not be strictly necessary.
return array_values( $days );
}, 10, 1 );
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
uncanny-automator-pro/src/integrations/datetime/conditions/datetime-is-specific-month-day.php:101
public function get_month_days_options() {
$days = array();
for ( $i = 1; $i < 32; $i++ ) {
$days[] = array(
'text' => $i,
'value' => $i,
);
}
return apply_filters( 'automator_datetime_conditions_month_days_options', $days );
}