gpb_max_duration

  1. Description
  2. Usage
  3. Parameters
  4. Examples
    1. Allow administrators to bypass the configured maximum duration.
  5. Since

Description

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

Usage

Applied globally

add_filter( 'gpb_max_duration', 'my_custom_function' );

Parameters

$max_duration int|null

The configured maximum duration in minutes.

$service Service

The service object.

Examples

Allow administrators to bypass the configured maximum duration.

add_filter( 'gpb_max_duration', function( $max_duration, $service ) {
    if ( ! current_user_can( 'manage_options' ) ) {
        return $max_duration;
    }
    return null;
}, 10, 2 );

Since

  • 1.1 Hook added.