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

How can I use WordPress hooks for custom fields in Amelia

Amelia provides several hooks related to custom fields, allowing you to modify custom field data or run custom actions when fields 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.

Custom field added

How do I modify custom field data before it is added?

amelia_before_cf_added_filter

Type: filter

Use this filter to modify custom field data before it is added.

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

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

How do I run code before a custom field is added?

amelia_before_cf_added

Type: action

Runs before a custom field is added.

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

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

How do I run code after a custom field is added?

amelia_after_cf_added

Type: action

Runs after a custom field is added.

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

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

Custom field updated

How do I modify custom field data before it is updated?

amelia_before_cf_updated_filter

Type: filter

Use this filter to modify custom field data before it is updated.

				
					function example($customField)
{
    return $customField;
}

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

How do I run code before a custom field is updated?

amelia_before_cf_updated

Type: action

Runs before a custom field is updated.

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

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

How do I run code after a custom field is updated?

amelia_after_cf_updated

Type: action

Runs after a custom field is updated.

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

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

Get custom fields

How do I modify custom fields before they are retrieved?

amelia_get_cfs_filter

Type: filter

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

				
					function example($customFields)
{
    return $customFields;
}

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

How do I run code before custom fields are retrieved?

amelia_get_cfs

Type: action

Runs before custom fields are retrieved for the back end.

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

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

Custom field deleted

How do I run code before a custom field is deleted?

amelia_before_cf_deleted

Type: action

Runs before a custom field is deleted.

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

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

How do I run code after a custom field is deleted?

amelia_after_cf_deleted

Type: action

Runs after a custom field is deleted.

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

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