Action_Scheduler\WP_CLI
System_Command::get_action_status_date
Get oldest or newest scheduled date for a given status.
Метод класса: System_Command{}
Хуков нет.
Возвращает
Строку.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_action_status_date( $status, $date_type );
- $status(строка) (обязательный)
- Action status label/name string.
- $date_type(строка)
- Oldest or Newest.
По умолчанию:'oldest'
Код System_Command::get_action_status_date() System Command::get action status date WC 10.9.4
protected function get_action_status_date( $status, $date_type = 'oldest' ) {
$order = 'oldest' === $date_type ? 'ASC' : 'DESC';
$args = array(
'status' => $status,
'per_page' => 1,
'order' => $order,
);
$action = $this->store->query_actions( $args );
if ( ! empty( $action ) ) {
$date_object = $this->store->get_date( $action[0] );
$action_date = $date_object->format( 'Y-m-d H:i:s O' );
} else {
$action_date = '–';
}
return $action_date;
}