English (United Kingdom)

apply_filters_ref_array( 'vikappointments_build_service_search_options_query', bool $status, mixed &$queryint $id )

Fires while fetching the list of available options.


Description

Trigger hook to manipulate at runtime the query used to load the available options to display under the Service Details page in the front-end.

Third party plugins can extend the query by applying further conditions or selecting additional data.


Parameters

$status

(bool)  True on success, false otherwise

 

&$query

(mixed)  Either a query builder object or a plain string.

$id

(int)  The ID of the service to which the options should be attached.

 


Example

The example below makes the options with ID 1, 2 and 3 always available for all the services.

/**
 * Trigger hook to manipulate the query at runtime. Third party plugins
 * can extend the query by applying further conditions or selecting
 * additional data.
 *
 * @param  bool    $status   True on success, false otherwise.
 * @param  mixed    &$query  Either a query builder or a query string.
 * @param  integer  $id      The service ID.
 */
add_action('vikappointments_build_service_search_options_query', function($status, &$query, $id)
{
   $query->orWhere('`id` IN (1,2,3)');

   return $status;
}, 10, 3);

Changelog

Version Description
1.2.5 Introduced.
Last Update: 2023-06-19
Helpful?
This site uses cookies. By continuing to browse you accept their use. Further information