wp_next_scheduled()返回一个定时时间的下一个时间标记

目录

描述

Returns the next timestamp for a cron event.

wp_next_scheduled() 描述

用法

<?php $timestamp wp_next_scheduled$hook$args ); ?>

wp_next_scheduled() 用法

参数

$hook

(string) (必填) Name of the action hook for event.

默认值: None

$args

(array) (可选) Arguments to pass to the hook function(s).

默认值: None

wp_next_scheduled() 参数

注意

  • Cron is named after a unix program which runs unattended scheduled tasks.

wp_next_scheduled() 注意

历史

添加于 版本: 2.1.0

wp_next_scheduled() 历史

源文件

wp_next_scheduled() 函数的代码位于 wp-includes/cron.php

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Retrieve the next timestamp for a cron event.
 *
 * @since 2.1.0
 *
 * @param string $hook Action hook to execute when cron is run.
 * @param array $args Optional. Arguments to pass to the hook's callback function.
 * @return false|int The UNIX timestamp of the next time the scheduled event will occur.
 */
function wp_next_scheduled( $hook, $args = array() ) {
	$crons = _get_cron_array();
	$key = md5(serialize($args));
	if ( empty($crons) )
		return false;
	foreach ( $crons as $timestamp => $cron ) {
		if ( isset( $cron[$hook][$key] ) )
			return $timestamp;
	}
	return false;
}

wp_next_scheduled() 源文件

相关