Cron Register everytime if i reload admin if i pass some extra argument in wp_schedule_event function

This happens because this code:

if ( ! wp_next_scheduled( 'myprefix_cron_hook' ) ) {
    wp_schedule_event( time(), 'every_one_hoursinwp', 'myprefix_cron_hook',array(42));
}

Is the same as this code:

if ( ! wp_next_scheduled( 'myprefix_cron_hook', array() ) ) {
    wp_schedule_event( time(), 'every_one_hoursinwp', 'myprefix_cron_hook',array(42));
}

And while you have lots of cron jobs with array(42), there is no next scheduled cron job with no arguments, so the if statement is true.

To fix this, use the second parameter of wp_next_scheduled:

https://developer.wordpress.org/reference/functions/wp_next_scheduled/

Think of it this way, if you had multiple cron jobs with different arguments, how would you check which ones have been scheduled if you couldn’t pass the arguments?

deneme bonusudeneme bonusu veren sitelerpulibet girişOnwin Güncel Giriştürkçe altyazılı pornocanlı bahis casino