Finally i can able to achieve it.
// custom_schedules_create
function custom_schedules_create( $schedules ) {
$schedules['every_three_minutes'] = array(
'interval' => 180,
'display' => __( 'Every 3 Minutes', 'textdomain' )
);
return $schedules;
}
add_filter( 'cron_schedules', 'custom_schedules_create' );
// custom_3minutes_event
if ( ! wp_next_scheduled( 'custom_3minutes_event' ) ) {
$myLocalGMTTimeEvent = time() + 6*60*60;
wp_schedule_event( $myLocalGMTTimeEvent, 'every_three_minutes', 'custom_3minutes_event' );
}
add_action( 'custom_3minutes_event', 'this_funtion_will_work' );
// this_funtion_will_work
function this_funtion_will_work() {
$the_query = get_posts( array(
'post_type' => 'page',
'post_status' => 'publish',
));
foreach($the_query as $single_post) {
$id = $single_post->ID;
$myLocalGMTTime = 6*60*60;
$getLocalGMTTime = time() + $myLocalGMTTime;
$getLocalGMTDate = date('H:i', $getLocalGMTTime);
$get_template = get_post_meta( $id, '_wp_page_template', true );
if( ( $getLocalGMTDate == '18:00' ) && ( 'page-delete.php' == $get_template )){
$update_post = array(
'ID' => $id,
'post_status' => 'private'
);
wp_update_post($update_post);
}
}
}