admin管理员组文章数量:1289543
I'm trying to flush rewrite rule with a wp_schedule_event
function el_custom_cron_schedule( $schedules ) {
$schedules['el_every_5mn'] = array(
'interval' => 5*60,
'display' => __( 'Every 5 minutes' ),
);
return $schedules;
}
add_filter( 'cron_schedules', 'el_custom_cron_schedule' );
// Flush permalinks every 5mn
function el_flush_permalinks_activation() {
if ( !wp_next_scheduled( 'el_5mn_event' ) ) {
wp_schedule_event(time(), 'el_every_5mn', 'el_5mn_event');
}
}
add_action('el_5mn_event', 'el_flush_permalinks');
add_action('wp', 'el_flush_permalinks_activation');
function el_flush_permalinks() {
flush_rewrite_rules(true);
}
So the Scheduled Task works, i test it with email sending (wp_mail
in the function el_flush_permalinks
)
The issue is that flush_rewrite_rules()
is not launch. i thought it was the the hook wp
but not.
Thanks for help
本文标签: permalinksFlush rewrite rules with scheduled event (cron)
版权声明:本文标题:permalinks - Flush rewrite rules with scheduled event (cron) 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741421521a2377832.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论