Developer Hooks
Extend, customize and integrate BookingPress, the most flexible WordPress booking plugin, with WordPress action & filter hooks. Hook into the booking lifecycle, payments, notifications and admin functionality, without editing any core files.
01 Introduction
BookingPress is built on standard WordPress extensibility. Use these hooks in your theme’s functions.php or a small custom plugin to run your own code at key moments — for example, push a new booking to a CRM, modify an email’s content, or add a custom payment field.
return the value).02 How hooks work
Register an action with add_action() and a filter with add_filter(), passing the hook name, your callback, a priority, and the number of arguments your callback accepts.
// Action — run code after a booking is created
add_action( 'bookingpress_after_book_appointment', 'my_after_booking', 10, 3 );
function my_after_booking( $booking_id, $entry_id, $gateway_data ) {
// your code…
}
// Filter — always return the (modified) value
add_filter( 'bookingpress_currency_support', 'my_currencies', 10, 2 );
function my_currencies( $not_allowed, $currency ) {
return $not_allowed;
}
03 Appointments 7 hooks
bookingpress_after_book_appointment
ActionTriggered immediately after an appointment has been created in BookingPress.
…-pro/core/classes/class.bookingpress_pro_payment_gateways.phpadd_action('bookingpress_after_book_appointment', 'bookingpress_after_book_appointment_func', 10, 3);
function bookingpress_after_book_appointment_func($inserted_booking_id, $entry_id, $payment_gateway_data)
{
//$inserted_booking_id Appointment id
//$entry_id entry id
//$payment_gateway_data payment gateway data
}
- $inserted_booking_id
- Inserted appointment id.
- $entry_id
- Entry id.
- $payment_gateway_data
- Payment gateway data.
bookingpress_after_rescheduled_appointment
ActionTriggered immediately after an appointment has been rescheduled in BookingPress.
…-pro/core/classes/class.bookingpress_pro_appointment.phpadd_action('bookingpress_after_rescheduled_appointment', 'bookingpress_rescheduled_func', 10);
function bookingpress_rescheduled_func($bookingpress_appointment_id)
{
//$bookingpress_appointment_id Appointment id
}
- $bookingpress_appointment_id
- Rescheduled appointment id.
bookingpress_after_cancel_appointment
ActionTriggered immediately after an appointment has been cancelled in BookingPress.
…/core/classes/frontend/class.bookingpress_appointment_bookings.phpadd_action('bookingpress_after_cancel_appointment', 'bookingpress_after_cancel_appointment_func', 10);
function bookingpress_after_cancel_appointment_func($cancel_id)
{
//$cancel_id appointment id
}
- $cancel_id
- Cancelled appointment id.
bookingpress_after_approve_appointment
ActionTriggered immediately when an appointment is approved after the payment status is manually set to ‘Paid’.
…/core/classes/class.bookingpress_payment.phpadd_action('bookingpress_after_approve_appointment', 'bookingpress_after_approve_appointment_func', 10);
function bookingpress_after_approve_appointment_func($payment_data)
{
//$payment_data payment data
}
- $payment_data
- Appointment payment data.
bookingpress_after_change_appointment_status
ActionTriggered immediately when an appointment status gets changed.
…/core/classes/class.bookingpress_calendar.phpadd_action('bookingpress_after_change_appointment_status', 'bookingpress_status_func', 10, 2);
function bookingpress_status_func($appointment_id, $bookingpress_appointment_status)
{
//$appointment_id updated appointment id
//$bookingpress_appointment_status updated status
}
- $appointment_id
- Booking id of the changed status.
- $bookingpress_appointment_status
- Appointment status.
bookingpress_after_update_appointment
ActionTriggered immediately whenever any appointment data is updated.
…/core/classes/class.bookingpress_calendar.phpadd_action('bookingpress_after_update_appointment', 'bookingpress_update_func', 10, 2);
function bookingpress_update_func($bookingpress_update_id, $bookingpress_appointment_data)
{
//$bookingpress_update_id updated appointment id
//$bookingpress_appointment_data updated appointment data
}
- $bookingpress_update_id
- Booking id of the updated appointment.
- $bookingpress_appointment_data
- Updated appointment data.
bookingpress_before_delete_appointment
ActionTriggered right before an appointment is removed from BookingPress.
…/core/classes/class.bookingpress_appointment.phpadd_action('bookingpress_before_delete_appointment', 'bookingpress_before_delete_func', 10);
function bookingpress_before_delete_func($appointment_id)
{
//$appointment_id for being deleted
}
- $appointment_id
- Booking id of the appointment.
04 Payments 2 hooks
bookingpress_after_refund_appointment
ActionTriggered immediately whenever a payment related to an appointment is refunded.
…-pro/core/classes/class.bookingpress_pro_payment_gateways.phpadd_action('bookingpress_after_refund_appointment', 'bookingpress_after_refund_func', 10);
function bookingpress_after_refund_func($bookingpress_appointment_id)
{
//$bookingpress_appointment_id Appointment id
}
- $bookingpress_appointment_id
- Appointment id.
bookingpress_currency_support
FilterAllows modifying the list of supported currencies.
…/core/classes/class.bookingpress_settings.phpadd_filter('bookingpress_currency_support', 'bookingpress_currency_support_func', 10, 2);
function bookingpress_currency_support_func($notAllow, $bookingpress_currency)
{
//$notAllow Not supported by payment gateways
//$bookingpress_currency Selected currency
return $notAllow;
}
- $notAllow
- Currencies not supported by payment gateways.
- $bookingpress_currency
- Selected currency.
05 Payment gateways 6 hooks
bookingpress_allowed_payment_gateway_for_refund
FilterAllows modifying the payment gateway data for refunds.
…-pro/core/classes/class.bookingpress_pro_global_options.phpadd_filter('bookingpress_allowed_payment_gateway_for_refund', 'bookingpress_refund_gateways_func', 10);
function bookingpress_refund_gateways_func($payment_gateway_data)
{
//$payment_gateway_data Payment gateway settings
return $payment_gateway_data;
}
- $payment_gateway_data
- Payment gateway settings.
bookingpress_gateway_listing_field
ActionAllows you to add payment gateway fields to the settings page.
…-pro/core/views/settings/payment_setting_tab.phpadd_action('bookingpress_gateway_listing_field', 'bookingpress_gateway_listing_field_func', 10);
function bookingpress_gateway_listing_field_func()
{
//Add your code
}
bookingpress_{payment_gateway}_apply_refund
FilterAllows modifying refund data related to a payment gateway. {payment_gateway} is replaced by the gateway slug (e.g. paypal, stripe).
…-pro/core/classes/class.bookingpress_pro_payment_gateways.phpadd_filter('bookingpress_{payment_gateway}_apply_refund', 'my_apply_refund_func', 10, 2);
//{payment_gateway} replaced with the actual slug like (paypal, stripe)
function my_apply_refund_func($response, $bookingpress_send_refund_data)
{
//$response response data array from payment gateway
//$bookingpress_send_refund_data passing data to the payment gateway
return $response;
}
- $response
- Response data array from the payment gateway.
- $bookingpress_send_refund_data
- Data sent to the payment gateway.
bookingpress_{payment_gateway}_submit_form_data
FilterAllows you to modify the booking-form submission data for the selected payment gateway.
…/core/classes/frontend/class.bookingpress_appointment_bookings.phpadd_filter('bookingpress_{payment_gateway}_submit_form_data', 'my_submit_form_data_func', 10, 2);
//{payment_gateway} replaced with the actual slug like (paypal, stripe)
function my_submit_form_data_func($response, $bookingpress_return_data)
{
//$response response data array from payment gateway
return $response;
}
- $response
- Response data array from the payment gateway.
- $bookingpress_return_data
- Return data from the payment gateway.
bookingpress_add_booking_form_summary_label_data
ActionTriggers to add HTML content for label settings on the customization page.
…/core/classes/class.bookingpress_customize.phpadd_action('bookingpress_add_booking_form_summary_label_data', 'my_summary_label_func', 10);
function my_summary_label_func()
{
//inject your code
}
bookingpress_add_setting_dynamic_data_fields
FilterModify or add settings data for the backend — useful for adding custom payment-gateway default data.
…/core/classes/class.bookingpress.phpadd_filter('bookingpress_add_setting_dynamic_data_fields', 'my_setting_fields_func', 10);
function my_setting_fields_func($bookingpress_dynamic_setting_data_fields)
{
//$bookingpress_dynamic_setting_data_fields Dynamic settings data variables
return $bookingpress_dynamic_setting_data_fields;
}
- $bookingpress_dynamic_setting_data_fields
- Dynamic settings data variables.
06 Email notifications 3 hooks
bookingpress_modify_email_notification_content
FilterModify the subject and content of email notifications for the customer and/or employee. Use custom placeholders and replace them here.
…/core/classes/class.bookingpress_email_notifications.phpadd_filter('bookingpress_modify_email_notification_content', 'my_email_content_func', 10, 4);
function my_email_content_func($message, $appointment_data, $notification_name, $template_type)
{
// Replace a custom placeholder in the subject/content
$message = str_replace( '%my_custom_placeholder%', 'my content', $message );
return $message;
}
- $message
- Subject or content of the email notification.
- $appointment_data
- Array containing the appointment data.
- $notification_name
- Name of the notification set in BookingPress → Notifications.
- $template_type
- Receiver type —
customeroremployee.
bookingpress_get_email_notiication_reply_to_data
FilterModify the ‘Reply-To’ data used in email notifications sent to the customer.
…/core/classes/class.bookingpress_email_notifications.phpadd_filter('bookingpress_get_email_notiication_reply_to_data', 'my_reply_to_func', 10, 2);
function my_reply_to_func($reply_to_data_arr, $appointment_id)
{
//$reply_to_data_arr Reply-to email array
return $reply_to_data_arr;
}
- $reply_to_data_arr
- Reply-to email array.
- $appointment_id
- Appointment id.
bookingpress_get_email_notiication_reply_to_data_employee
FilterModify the ‘Reply-To’ data used in email notifications sent to the admin or staff.
…/core/classes/class.bookingpress_email_notifications.phpadd_filter('bookingpress_get_email_notiication_reply_to_data_employee', 'my_reply_to_emp_func', 10, 2);
function my_reply_to_emp_func($reply_to_data_arr, $appointment_id)
{
//$reply_to_data_arr Reply-to email array
return $reply_to_data_arr;
}
- $reply_to_data_arr
- Reply-to email array.
- $appointment_id
- Appointment id.
07 Staff members 1 hook
bookingpress_staff_members_save_external_details
FilterCan be used to save additional data for a staff member.
…-pro/core/classes/class.bookingpress_pro_staff_members.phpadd_filter('bookingpress_staff_members_save_external_details', 'my_staff_external_func', 10);
function my_staff_external_func($response)
{
//$response member details response
return $response;
}
- $response
- Member details response.
08 Customization 3 hooks
bookingpress_get_booking_form_customize_data_filter
FilterAllows modifying the backend customize-page data.
…/core/classes/class.bookingpress_customize.phpadd_filter('bookingpress_get_booking_form_customize_data_filter', 'my_customize_data_func', 10);
function my_customize_data_func($bookingpress_booking_form_data)
{
//$bookingpress_booking_form_data Front form data
return $bookingpress_booking_form_data;
}
- $bookingpress_booking_form_data
- Front form data.
bookingpress_customize_add_dynamic_data_fields
FilterAllows modifying the customize-page default data.
…-pro/core/classes/class.bookingpress.phpadd_filter('bookingpress_customize_add_dynamic_data_fields', 'my_customize_fields_func', 10);
function my_customize_fields_func($bookingpress_customize_vue_data_fields)
{
//$bookingpress_customize_vue_data_fields vuejs data
return $bookingpress_customize_vue_data_fields;
}
- $bookingpress_customize_vue_data_fields
- Customize data fields array.
bookingpress_after_save_customize_settings
ActionTriggered immediately after saving the customize-page settings.
…/core/classes/class.bookingpress_customize.phpadd_action('bookingpress_after_save_customize_settings', 'my_after_save_customize_func', 10);
function my_after_save_customize_func()
{
//inject your code
}
09 Settings 2 hooks
bookingpress_general_settings_add_tab_filter
FilterProvides the facility to create a custom tab for settings.
…-pro/core/classes/manage_settings.phpadd_filter('bookingpress_general_settings_add_tab_filter', 'my_settings_tab_func', 10);
function my_settings_tab_func($bookingpress_file_url)
{
//$bookingpress_file_url[] = File URL
return $bookingpress_file_url;
}
- $bookingpress_file_url
- Absolute directory file URL.
boookingpress_after_save_settings_data
ActionTriggered immediately after saving the settings data.
…/core/classes/class.bookingpress_services.phpadd_action('boookingpress_after_save_settings_data', 'my_after_save_settings_func', 10);
function my_after_save_settings_func($posted_data)
{
//$posted_data posted data
}
- $posted_data
- Data posted by the request.
Note: the hook name has a triple-o (boookingpress) as defined in core.
10 Miscellaneous 2 hooks
bpa_complete_payment_add_card_options
ActionUsed to add custom HTML for a payment gateway on the Complete Payment page.
…-pro/core/views/frontend/appointment_booking_payment.phpadd_action('bpa_complete_payment_add_card_options', 'my_complete_payment_func', 10);
function my_complete_payment_func()
{
//inject your code
}
bpa_front_add_card_options
ActionUsed to add custom HTML for a payment gateway on the booking form.
…-pro/core/views/frontend/appointment_booking_form.phpadd_action('bpa_front_add_card_options', 'my_front_card_func', 10);
function my_front_card_func()
{
//inject your code
}
Need the REST API instead? Manage bookings from external apps over HTTP.
REST API reference →