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

How can I use WordPress hooks for resources in Amelia

Amelia provides several hooks related to resources, allowing you to modify resource data or run custom actions when resources are added, updated, retrieved, or deleted. These hooks help you extend Amelia safely without adjusting core plugin files.

Info Note

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

Resource added

How do I modify resource data before it is added?

amelia_before_resource_added_filter

Type: filter

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

				
					function example($resource)
{
    // change resource data
    return $resource;
}

add_filter('amelia_before_resource_added_filter', 'example', 10, 1);
				
			

How do I run code before a resource is added?

amelia_before_resource_added

Type: action

Runs before a resource is added.

				
					function example($resource)
{
    // do action
}

add_action('amelia_before_resource_added', 'example', 10, 1);
				
			

How do I run code after a resource is added?

amelia_after_resource_added

Type: action

Runs after a resource is added.

				
					function example($resource)
{
    // do action
}

add_action('amelia_after_resource_added', 'example', 10, 1);
				
			

Resource updated

How do I modify resource data before it is updated?

amelia_before_resource_updated_filter

Type: filter

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

				
					function example($resource)
{
    // change resource data
    return $resource;
}

add_filter('amelia_before_resource_updated_filter', 'example', 10, 1);
				
			

How do I run code before a resource is updated?

amelia_before_resource_updated

Type: action

Runs before a resource is updated.

				
					function example($resource)
{
    // do action
}

add_action('amelia_before_resource_updated', 'example', 10, 1);
				
			

How do I run code after a resource is updated?

amelia_after_resource_updated

Type: action

Runs after a resource is updated.

				
					function example($resource)
{
    // do action
}

add_action('amelia_after_resource_updated', 'example', 10, 1);
				
			

Get resources

How do I modify resources before they are retrieved?

amelia_get_resources_filter

Type: filter

Use this filter to modify resources before they are retrieved for the back end.

				
					function example($resources)
{
    // change resources
    return $resources;
}

add_filter('amelia_get_resources_filter', 'example', 10, 1);
				
			

How do I run code before resources are retrieved?

amelia_get_resources

Type: action

Runs before resources are retrieved for the back end.

				
					function example($resources)
{
    // do action
}

add_action('amelia_get_resources', 'example', 10, 1);
				
			

Resource deleted

How do I run code before a resource is deleted?

amelia_before_resource_deleted

Type: action

Runs before a resource is deleted.

				
					function example($resourceId)
{
    // do action
}

add_action('amelia_before_resource_deleted', 'example', 10, 1);
				
			

How do I run code after a resource is deleted?

amelia_after_resource_deleted

Type: action

Runs after a resource is deleted.

				
					function example($resourceId)
{
    // do action
}

add_action('amelia_after_resource_deleted', 'example', 10, 1);