How can I use WordPress hooks for services in Amelia
Amelia provides several hooks related to services, allowing you to modify service data or run custom actions when services are added, updated, retrieved, or deleted. These hooks help you extend Amelia safely without adjusting core plugin files.
Hooks require programming knowledge, and support is limited to general guidance.
Service added
How do I modify service data before it is added?
amelia_before_service_added_filter
Type: filter
Use this filter to modify service data before it is added.
function example($service)
{
// change service data
return $service;
}
add_filter('amelia_before_service_added_filter', 'example', 10, 1);
How do I run code before a service is added?
amelia_before_service_added
Type: action
Runs before a service is added.
function example($service)
{
// do action
}
add_action('amelia_before_service_added', 'example', 10, 1);
How do I run code after a service is added?
amelia_after_service_added
Type: action
Runs after a service is added.
function example($service)
{
// do action
}
add_action('amelia_after_service_added', 'example', 10, 1);
Service updated
How do I modify service data before it is updated?
amelia_before_service_updated_filter
Type: filter
Use this filter to modify service data before it is updated.
function example($service)
{
// change service data
return $service;
}
add_filter('amelia_before_service_updated_filter', 'example', 10, 1);
How do I run code before a service is updated?
amelia_before_service_updated
Type: action
Runs before a service is updated.
function example($service)
{
// do action
}
add_action('amelia_before_service_updated', 'example', 10, 1);
How do I run code after a service is updated?
amelia_after_service_updated
Type: action
Runs after a service is updated.
function example($service)
{
// do action
}
add_action('amelia_after_service_updated', 'example', 10, 1);
Get services
How do I modify services before they are retrieved?
amelia_get_services_filter
Type: filter
Use this filter to modify services before they are retrieved for the back end.
function example($services)
{
// change services
return $services;
}
add_filter('amelia_get_services_filter', 'example', 10, 1);
How do I run code before services are retrieved?
amelia_get_services
Type: action
Runs before services are retrieved for the back end.
function example($services)
{
// do action
}
add_action('amelia_get_services', 'example', 10, 1);
Get service
How do I modify a service before it is retrieved?
amelia_get_service_filter
Type: filter
Use this filter to modify service data before it is retrieved for the back end.
function example($service)
{
return $service;
}
add_filter('amelia_get_service_filter', 'example', 10, 1);
How do I run code before a service is retrieved?
function example($service)
{
// do action
}
add_action('amelia_get_service', 'example', 10, 1);
Service deleted
How do I run code before a service is deleted?
amelia_before_service_deleted
Type: action
Runs before a service is deleted.
function example($service)
{
// do action
}
add_action('amelia_before_service_deleted', 'example', 10, 1);
How do I run code after a service is deleted?
amelia_after_service_deleted
Type: action
Runs after a service is deleted.
function example($service)
{
// do action
}
add_action('amelia_after_service_deleted', 'example', 10, 1);