gpb_min_duration

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Allow administrators to bypass the configured minimum and book a single block.
  5. Since

Description

Filter the minimum booking duration. This can be used to change the enforced minimum for a role or other request context without changing the Service setting.

Usage

Applied globally

add_filter( 'gpb_min_duration', 'my_custom_function' );

Parameters

$min_duration int|null

The configured minimum duration in minutes.

$service Service

The service object.

Examples

Allow administrators to bypass the configured minimum and book a single block.

add_filter( 'gpb_min_duration', function( $min_duration, $service ) {
    if ( ! current_user_can( 'manage_options' ) ) {
        return $min_duration;
    }
    return $service->get_block_size();
}, 10, 2 );

Since

  • 1.1 Hook added.