arkadaşlar bu kodlarda wordpress cronjob için dakikada bir çalıştırma yapılıyor sanırsam

ama ben bu kodları nasıl wordpress e yerleştireceğimi anlamadım yardımcı olabilir misiniz?


By Default WordPress have three schedule time recurrence(hourly, twicedaily, daily) to add your event. Hourly runs in every hour, twicedaily runs in each 12 hours and daily runs in every 24 hours.

To add new custom timed schedule, cron_schedules filter is used. Lets add three new cron schedule ( in_per_minute, in_per_ten_minute, three_hourly ).

Add WordPress Custom Schedules

add_filter( 'cron_schedules', 'my_corn_schedules');
function my_corn_schedules(){
	return array(
		'in_per_minute' => array(
			'interval' => 60,
			'display' => 'In every Mintue'
		),
		'in_per_ten_minute' => array(
			'interval' => 60 * 10,
			'display' => 'In every two Mintues'
		),
		'three_hourly' => array(
			'interval' => 60 * 60 * 3,
			'display' => 'Once in Three minute'
		)
	);
}
Here interval is measured in seconds. 2 minute = 60 * 2 sec. display is the Display label name for this schedule.

Schedule a WordPress event that will run in every minute

if( !wp_next_scheduled( 'my_one_minute_event' )){
	wp_schedule_event( time(), 'in_per_minute', 'my_one_minute_event' );
}
This code will add a new hook my_one_minute_event to be run in every minute by cron. Add action to this hook with your function.

Hook to a WordPress scheduled event with your function

function my_function(){
// your code here
}
add_action( 'my_one_minute_event', 'my_function' );