ActionScheduler_wpPostStore::action_counts
Get a count of all actions in the store, grouped by status
Метод класса: ActionScheduler_wpPostStore{}
Хуков нет.
Возвращает
Массив.
Использование
$ActionScheduler_wpPostStore = new ActionScheduler_wpPostStore(); $ActionScheduler_wpPostStore->action_counts();
Код ActionScheduler_wpPostStore::action_counts() ActionScheduler wpPostStore::action counts WC 10.3.4
public function action_counts() {
$action_counts_by_status = array();
$action_stati_and_labels = $this->get_status_labels();
$posts_count_by_status = (array) wp_count_posts( self::POST_TYPE, 'readable' );
foreach ( $posts_count_by_status as $post_status_name => $count ) {
try {
$action_status_name = $this->get_action_status_by_post_status( $post_status_name );
} catch ( Exception $e ) {
// Ignore any post statuses that aren't for actions.
continue;
}
if ( array_key_exists( $action_status_name, $action_stati_and_labels ) ) {
$action_counts_by_status[ $action_status_name ] = $count;
}
}
return $action_counts_by_status;
}