wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_get_schedule › WordPress Function

Since2.1.0
已弃用n/a
wp_get_schedule ( $hook, $args = array() )
参数: (2)
  • (string) $hook Action hook to identify the event.
    Required: Yes
  • (array) $args Optional. Arguments passed to the event's callback function. Default empty array.
    Required: No
    默认: array()
查看:
返回:
  • (string|false) Schedule name on success, false if no schedule.
定义在:
文档:
Change Log:
  • 5.1.0

Retrieves the name of the recurrence schedule for an event.



源码

function wp_get_schedule( $hook, $args = array() ) {
	$schedule = false;
	$event    = wp_get_scheduled_event( $hook, $args );

	if ( $event ) {
		$schedule = $event->schedule;
	}

	/**
	 * Filters the schedule name for a hook.
	 *
	 * @since 5.1.0
	 *
	 * @param string|false $schedule Schedule for the hook. False if not found.
	 * @param string       $hook     Action hook to execute when cron is run.
	 * @param array        $args     Arguments to pass to the hook's callback function.
	 */
	return apply_filters( 'get_schedule', $schedule, $hook, $args );
}