WordPress at Your Fingertips
function is not described

ActionScheduler_DBStore::get_group_id() protected WC 1.0

Get a group's ID based on its name/slug.

{} It's a method of the class: ActionScheduler_DBStore{}

No Hooks.


Int. The group's ID, if it exists or is created, or 0 if it does not exist and is not created.


// protected - for code of main (parent) or child class
$result = $this->get_group_id( $slug, $create_if_not_exists );
$slug(string) (required)
The string name of a group.
Whether to create the group if it does not already exist. Default, true - create the group.
Default: true

Code of ActionScheduler_DBStore::get_group_id() WC 6.1.0

protected function get_group_id( $slug, $create_if_not_exists = true ) {
	if ( empty( $slug ) ) {
		return 0;
	/** @var \wpdb $wpdb */
	global $wpdb;
	$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 );

	return $group_id;