Note on input arguments:
You are using the filter callback function (FCB) with two input arguments, but the default is one.
In general you should replace:
add_filter( 'some_filter', 'some_filter_callback' );
function some_filter_callback( $arg1, $arg2 ) {
with something like:
add_filter( 'some_filter', 'some_filter_callback', 10, 2 );
function some_filter_callback( $arg1, $arg2 ) {
if you want two arguments.
You would also have to look at the apply_filters( 'some_filter', ... )
part to find the correct number of input arguments.
The problem:
When you check the source of wp_get_schedules()
you find the following:
return array_merge( apply_filters( 'cron_schedules', array() ), $schedules );
so there’s no second $int
argument passed on to the FCB.
The array that you return from your FCB is then merged with the default $schedules
, where:
$schedules = array(
'hourly' => array( 'interval' => HOUR_IN_SECONDS, 'display' => __( 'Once Hourly' ) ),
'twicedaily' => array( 'interval' => 12 * HOUR_IN_SECONDS, 'display' => __( 'Twice Daily' ) ),
'daily' => array( 'interval' => DAY_IN_SECONDS, 'display' => __( 'Once Daily' ) ),
);
Hope this helps.