Limited time discount Book Smarter This Christmas
Up to 50%Off

How can I use WordPress hooks for locations in Amelia

Amelia provides several hooks related to locations, allowing you to modify data before it is saved or retrieved, or run custom actions when a location is added, updated, fetched, or deleted. These hooks help you extend Amelia safely without adjusting core plugin files.

Info Please note

Hooks require programming knowledge, and support is limited to general guidance.

Location added

How do I modify a location before it is added?

amelia_before_location_added_filter

Type: filter

Use this filter to modify location data before it is added.

				
					function example($location) {
    // change location data
    return $location;
}
add_filter('amelia_before_location_added_filter', 'example', 10, 1);

				
			

How do I run code before a location is added?

amelia_before_location_added

Type: action

Runs before the location is added.

				
					function example($location) {
    // do action
}
add_action('amelia_before_location_added', 'example', 10, 1);

				
			

How do I run code after a location is added?

amelia_after_location_added

Type: action

Runs after the location is added.

				
					function example($location) {
    // do action
}
add_action('amelia_after_location_added', 'example', 10, 1);

				
			

Location updated

How do I modify a location before it is updated?

amelia_before_location_updated_filter

Type: filter

Use this filter to modify location data before it is updated.

				
					function example($location) {
    // change location data
    return $location;
}
add_filter('amelia_before_location_updated_filter', 'example', 10, 1);

				
			

How do I run code before a location is updated?

amelia_before_location_updated

Type: action

Runs before the location is updated.

				
					function example($location) {
    // do action
}
add_action('amelia_before_location_updated', 'example', 10, 1);

				
			

How do I run code after a location is updated?

amelia_after_location_updated

Type: action

Runs after the location is updated.

				
					function example($location) {
    // do action
}
add_action('amelia_after_location_updated', 'example', 10, 1);

				
			

Get locations

How do I modify the list of locations before it is returned?

amelia_get_locations_filter

Type: filter

Use this filter to modify the list of locations before it is returned.

				
					function example($locations) {
    return $locations;
}
add_filter('amelia_get_locations_filter', 'example', 10, 1);

				
			

How do I run code before locations are retrieved?

amelia_get_locations

Type: action

Runs before the locations are retrieved for the back end.

				
					function example($locations) {
    // do action
}
add_action('amelia_get_locations', 'example', 10, 1);

				
			

Get location

How do I modify a single location before it is retrieved?

amelia_get_location_filter

Type: filter

Use this filter to change the location data before it is retrieved.

				
					function example($location) {
    return $location;
}
add_filter('amelia_get_location_filter', 'example', 10, 1);

				
			

How do I run code before a single location is retrieved?

amelia_get_location

Type: action

Runs before the location is retrieved.

				
					function example($location) {
    // do action
}
add_action('amelia_get_location', 'example', 10, 1);

				
			

Location deleted

How do I run code before a location is deleted?

amelia_before_location_deleted

Type: action

Runs before the location is deleted.

				
					function example($location) {
    // do action
}
add_action('amelia_before_location_deleted', 'example', 10, 1);

				
			

How do I run code after a location is deleted?

amelia_after_location_deleted

Type: action

Runs after the location is deleted.

				
					function example($location) {
    // do action
}
add_action('amelia_after_location_deleted', 'example', 10, 1);