我的代码:
代码如下:
// Schedule a task to execute every Friday
add_action( 'friday_task', function() {
// Your code here
});
// Schedule the Friday event
if ( ! wp_next_scheduled( 'friday_task' ) ) {
wp_schedule_event( time(), 'weekly', 'friday_task' );
}
解决:
我把代码放到functions.php就好了