Php 如何在WordPress中1小时后发送电子邮件进行用户注册而不使用cron
我想在1小时后发送一封用户注册电子邮件。我曾经使用过WordPress cron,但是如果没有这个定义('DISABLE_WP_cron',true),它就不能工作因此,当添加此配置文件时,DataFeedrAPI会抛出其错误Php 如何在WordPress中1小时后发送电子邮件进行用户注册而不使用cron,php,wordpress,cron,Php,Wordpress,Cron,我想在1小时后发送一封用户注册电子邮件。我曾经使用过WordPress cron,但是如果没有这个定义('DISABLE_WP_cron',true),它就不能工作因此,当添加此配置文件时,DataFeedrAPI会抛出其错误 Error : Warning: Datafeedr Product Set updates cannot run because the WordPress Cron is disabled. Open your wp-config.php file and remov
Error : Warning: Datafeedr Product Set updates cannot run because the WordPress Cron is disabled. Open your wp-config.php file and remove this line: define('DISABLE_WP_CRON', true );.
因此,我在这种情况下所做的是,请建议在WordPress中使用1小时后发送电子邮件的任何其他方式
我用过这个代码
$args = array( $user_id );
if ( ! wp_next_scheduled( 'first_step_register_cron', $args ) ) {
wp_schedule_single_event( time() + 3600, 'first_step_register_cron', $args );
}
你说的很奇怪。您的代码看起来没问题,但运行WP cron并定义('DISABLE_WP_cron',true);是一枚硬币的两面。您可以让wp运行并工作,也可以禁用它们。你不能两者兼得。您的代码不可能仅在您有该定义的情况下工作,因为该定义实际上是为了首先禁用cron。我想说的一定是别的