How do WordPress hooks work for appointments in Amelia
Amelia provides several hooks related to appointments, allowing you to modify appointment data before it is saved or retrieved, or run custom actions when an appointment is added, updated, fetched, or deleted. These hooks help you extend Amelia safely without modifying core plugin files.
Hooks require programming knowledge, and support is limited to general guidance.
Appointment added
How do I modify an appointment before it is added?
amelia_before_appointment_added_filter
Type: filter
Use this filter to modify appointment data before it is added from the back end.
function example($appointment, $service, $paymentData)
{
// change appointment data
return $appointment;
}
add_filter('amelia_before_appointment_added_filter', 'example', 10, 3);
How do I run code before an appointment is added?
amelia_before_appointment_added
Type: action
Runs before an appointment is added from the back end.
function example($appointment, $service, $paymentData)
{
// do action
}
add_action('amelia_before_appointment_added', 'example', 10, 3);
How do I run code after an appointment is added?
amelia_after_appointment_added
Type: action
Runs after an appointment is added from the back end.
function example($appointment, $service, $paymentData)
{
// do action
}
add_action('amelia_after_appointment_added', 'example', 10, 3);
Appointment updated
How do I modify an appointment before it is updated?
amelia_before_appointment_updated_filter
Type: filter
Use this filter to modify appointment data before it is updated from the back end.
function example($appointment, $removedBookings, $service)
{
// change appointment data
return $appointment;
}
add_filter('amelia_before_appointment_updated_filter', 'example', 10, 3);
How do I run code before an appointment is updated?
amelia_before_appointment_updated
Type: action
Runs before an appointment is updated from the back end.
function example($appointment, $removedBookings, $service)
{
// do action
}
add_action('amelia_before_appointment_updated', 'example', 10, 3);
How do I run code after an appointment is updated?
amelia_after_appointment_updated
Type: action
Runs after an appointment is updated from the back end.
function example($appointment, $oldAppointment, $removedBookings, $service, $paymentData)
{
// do action
}
add_action('amelia_after_appointment_updated', 'example', 10, 5);
Appointment status updated
How do I run code before an appointment status is updated?
amelia_before_appointment_status_updated
Type: action
Runs before the appointment status is updated from the back end.
function example($appointment, $requestedStatus)
{
// do action
}
add_action('amelia_before_appointment_status_updated', 'example', 10, 2);
How do I run code after an appointment status is updated?
amelia_after_appointment_status_updated
Type: action
Runs after the appointment status is updated from the back end.
function example($appointment, $requestedStatus)
{
// do action
}
add_action('amelia_after_appointment_status_updated', 'example', 10, 2);
Get appointments
How do I modify appointments before they are retrieved?
amelia_get_appointments_filter
Type: filter
Use this filter to modify appointments before they are retrieved for the back end.
function example($appointments)
{
// change appointments
return $appointments;
}
add_filter('amelia_get_appointments_filter', 'example', 10, 1);
How do I run code before appointments are retrieved?
amelia_get_appointments
Type: action
Runs before appointments are retrieved for the back end.
function example($appointments)
{
// do action
}
add_action('amelia_get_appointments', 'example', 10, 1);
Get appointment
How do I modify an appointment before it is retrieved?
amelia_get_appointment_filter
Type: filter
Use this filter to modify appointment data before it is retrieved for the back end.
function example($appointment)
{
// change appointment data
return $appointment;
}
add_filter('amelia_get_appointment_filter', 'example', 10, 1);
How do I run code before an appointment is retrieved?
amelia_get_appointment
Type: action
Runs before an appointment is retrieved for the back end.
function example($appointment)
{
// do action
}
add_action('amelia_get_appointment', 'example', 10, 1);
Appointment deleted
How do I run code before an appointment is deleted?
amelia_before_appointment_deleted
Type: action
Runs before an appointment is deleted from the back end.
function example($appointment)
{
// do action
}
add_action('amelia_before_appointment_deleted', 'example', 10, 1);
How do I run code after an appointment is deleted?
function example($appointment)
{
// do action
}
add_action('amelia_after_appointment_deleted', 'example', 10, 1);