ActionScheduler_Store::find_action()
Find an action.
Note: the query ordering changes based on the passed 'status' value.
Метод класса: ActionScheduler_Store{}
Хуков нет.
Возвращает
Строку|null
. ID of the next action matching the criteria or NULL if not found.
Использование
$ActionScheduler_Store = new ActionScheduler_Store(); $ActionScheduler_Store->find_action( $hook, $params );
- $hook(строка) (обязательный)
- Action hook.
- $params(массив)
- Parameters of the action to find.
По умолчанию: array()
Код ActionScheduler_Store::find_action() ActionScheduler Store::find action WC 9.3.3
public function find_action( $hook, $params = array() ) { $params = wp_parse_args( $params, array( 'args' => null, 'status' => self::STATUS_PENDING, 'group' => '', ) ); // These params are fixed for this method. $params['hook'] = $hook; $params['orderby'] = 'date'; $params['per_page'] = 1; if ( ! empty( $params['status'] ) ) { if ( self::STATUS_PENDING === $params['status'] ) { $params['order'] = 'ASC'; // Find the next action that matches. } else { $params['order'] = 'DESC'; // Find the most recent action that matches. } } $results = $this->query_actions( $params ); return empty( $results ) ? null : $results[0]; }