// Flush permalinks every hour add_action('my_hourly_event', 'do_this_hourly'); function my_activation() { if ( !wp_next_scheduled( 'my_hourly_event' ) ) { wp_schedule_event(time(), 'hourly', 'my_hourly_event'); } } add_action('wp', 'my_activation'); function do_this_hourly() { global $wp_rewrite; $wp_rewrite->flush_rules(); }