ActionScheduler_DBStore::get_group_ids()
Get a group's ID based on its name/slug.
Метод класса: ActionScheduler_DBStore{}
Хуков нет.
Возвращает
Массив
. The group IDs, if they exist or were successfully created. May be empty.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->get_group_ids( $slugs, $create_if_not_exists );
- $slugs(строка|массив) (обязательный)
- The string name of a group, or names for several groups.
- $create_if_not_exists(true|false)
- Whether to create the group if it does not already exist. Default, true - create the group.
По умолчанию: true
Код ActionScheduler_DBStore::get_group_ids() ActionScheduler DBStore::get group ids WC 9.5.1
protected function get_group_ids( $slugs, $create_if_not_exists = true ) { $slugs = (array) $slugs; $group_ids = array(); if ( empty( $slugs ) ) { return array(); } /** @var \wpdb $wpdb */ global $wpdb; foreach ( $slugs as $slug ) { $group_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT group_id FROM {$wpdb->actionscheduler_groups} WHERE slug=%s", $slug ) ); if ( empty( $group_id ) && $create_if_not_exists ) { $group_id = $this->create_group( $slug ); } if ( $group_id ) { $group_ids[] = $group_id; } } return $group_ids; }