gpb_default_status

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Set different default statuses by Service ID.
  5. Since

Description

Filters the default booking status.

Usage

Applied globally

add_filter( 'gpb_default_status', 'my_custom_function' );

Parameters

$status string

The default booking status from settings.

$bookable Bookable|null

The bookable object being booked.

$entry array|null

The GF entry array.

Examples

Set different default statuses by Service ID.

add_filter( 'gpb_default_status', function( $status, $bookable, $entry ) {
    if ( ! $bookable ) {
        return $status;
    }
    $service_statuses = [
        10 => 'confirmed',
        13 => 'pending',
    ];
    return $service_statuses[ $bookable->get_id() ] ?? $status;
}, 10, 3 );

Since

  • 1.0-beta-1.5 Hook added.