0
我添加自定義的時間間隔如下WordPress的cron時間表可以使用變量設置?
當我提交從此我得到使用$ _ POST
add_filter('cron_schedules', 'my_cron_custom_hook');
function my_cron_custom_hook($schedules) {
if (isset($_POST['expiry'])) {
$settings = $_POST['expiry'];
$expiry = $settings['expiry']; -- > got the value
}
$schedules['specific_time'] = array(
'interval' => $expiry,--> (Got value here)
'display' => __('Specific Time')
);
}
在這種情況下,我得到的價值$到期值
add_filter('cron_schedules', 'my_cron_custom_hook');
function my_cron_custom_hook($schedules) {
$settings = get_option('from_value');
$expiry = $settings['expiry'];
$schedules['specific_time'] = array(
'interval' => $expiry,--> (can't get the value here)
'display' => __('Specific Time')
);
}
我無法得到的價值$屆滿
當我點擊提交按鈕twise時,只有$ expiry值是可見的。 這是什麼解決方案?