ActionScheduler_ActionFactory::get_stored_action()publicWC 1.0

Return stored actions for given params.

Метод класса: ActionScheduler_ActionFactory{}


ActionScheduler_Action. An instance of the stored action.


$ActionScheduler_ActionFactory = new ActionScheduler_ActionFactory();
$ActionScheduler_ActionFactory->get_stored_action( $status, $hook, $args, $schedule, $group );
$status(строка) (обязательный)
The action's status in the data store.
$hook(строка) (обязательный)
The hook to trigger when this action runs.
Args to pass to callbacks when the hook is triggered.
По умолчанию: array()
The action's schedule.
По умолчанию: null
A group to put the action in. phpcs:ignore Squiz.Commenting.FunctionComment.ExtraParamComment
По умолчанию: ''

Код ActionScheduler_ActionFactory::get_stored_action() WC 8.7.0

public function get_stored_action( $status, $hook, array $args = array(), ActionScheduler_Schedule $schedule = null, $group = '' ) {
	// The 6th parameter ($priority) is not formally declared in the method signature to maintain compatibility with
	// third-party subclasses created before this param was added.
	$priority = func_num_args() >= 6 ? (int) func_get_arg( 5 ) : 10;

	switch ( $status ) {
		case ActionScheduler_Store::STATUS_PENDING:
			$action_class = 'ActionScheduler_Action';
		case ActionScheduler_Store::STATUS_CANCELED:
			$action_class = 'ActionScheduler_CanceledAction';
			if ( ! is_null( $schedule ) && ! is_a( $schedule, 'ActionScheduler_CanceledSchedule' ) && ! is_a( $schedule, 'ActionScheduler_NullSchedule' ) ) {
				$schedule = new ActionScheduler_CanceledSchedule( $schedule->get_date() );
			$action_class = 'ActionScheduler_FinishedAction';

	$action_class = apply_filters( 'action_scheduler_stored_action_class', $action_class, $status, $hook, $args, $schedule, $group );

	$action = new $action_class( $hook, $args, $schedule, $group );
	$action->set_priority( $priority );

	 * Allow 3rd party code to change the instantiated action for a given hook, args, schedule and group.
	 * @param ActionScheduler_Action   $action The instantiated action.
	 * @param string                   $hook The instantiated action's hook.
	 * @param array                    $args The instantiated action's args.
	 * @param ActionScheduler_Schedule $schedule The instantiated action's schedule.
	 * @param string                   $group The instantiated action's group.
	 * @param int                      $priority The action priority.
	return apply_filters( 'action_scheduler_stored_action_instance', $action, $hook, $args, $schedule, $group, $priority );