action
Fires after a new custom field definition is created.
Parameters of davo_custom_field_created Parameter Type Description $field_id string New field's stable ID. $owner_type string Owner type slug. $definition array<string, mixed> Newly created, decoded definition.
add_action Copyadd_action ( 'davo_custom_field_created' , 'my_action_callback' , 10 , 3 );
/**
* @param string $field_id
* @param string $owner_type
* @param array<string, mixed> $definition
*/
function my_action_callback ( $field_id , $owner_type , $definition ) {
// Your code here.
}src/domains/custom-fields/services/definitions.php:243
filter
Filters a custom field definition before it is returned by the API.
Parameters of davo_custom_field_definition_response Parameter Type Description $definition array<string, mixed> The decoded field definition.
Returns array<string, mixed>
add_filter Copyadd_filter ( 'davo_custom_field_definition_response' , 'my_filter_callback' , 10 , 1 );
/**
* @param array<string, mixed> $definition
*/
function my_filter_callback ( $definition ) {
// Change $definition as needed, then return it.
return $definition ;
}src/domains/custom-fields/helpers.php:269
action
Fires after a custom field definition is deleted.
Parameters of davo_custom_field_deleted Parameter Type Description $field_id string Deleted field's stable ID. $definition array<string, mixed> The definition as it existed just before deletion. $values_purged bool Whether stored values were also purged.
add_action Copyadd_action ( 'davo_custom_field_deleted' , 'my_action_callback' , 10 , 3 );
/**
* @param string $field_id
* @param array<string, mixed> $definition
* @param bool $values_purged
*/
function my_action_callback ( $field_id , $definition , $values_purged ) {
// Your code here.
}src/domains/custom-fields/services/definitions.php:419
action
Fires after a content type registers itself as a Custom Fields owner.
Parameters of davo_custom_field_owner_type_registered Parameter Type Description $owner_type string Normalized owner type slug. $definition array<string, mixed> Normalized owner-type registration.
add_action Copyadd_action ( 'davo_custom_field_owner_type_registered' , 'my_action_callback' , 10 , 2 );
/**
* @param string $owner_type
* @param array<string, mixed> $definition
*/
function my_action_callback ( $owner_type , $definition ) {
// Your code here.
}src/domains/custom-fields/services/owner-registry.php:128
action
Fires after a Custom Fields owner type's field order is changed.
Parameters of davo_custom_field_reordered Parameter Type Description $owner_type string Owner type slug. $order array<string> New field_id order.
add_action Copyadd_action ( 'davo_custom_field_reordered' , 'my_action_callback' , 10 , 2 );
/**
* @param string $owner_type
* @param array<string> $order
*/
function my_action_callback ( $owner_type , $order ) {
// Your code here.
}src/domains/custom-fields/services/definitions.php:605
action
Fires once after any change to an owner type's field definitions (create, update, delete, or reorder) that could affect its public schema — a single, coarse-grained signal for cache invalidation, distinct from the four granular lifecycle actions above which describe *what* changed.
Parameters of davo_custom_field_schema_changed Parameter Type Description $owner_type string Owner type slug whose schema changed. $version int New schema version number for this owner type.
add_action Copyadd_action ( 'davo_custom_field_schema_changed' , 'my_action_callback' , 10 , 2 );
/**
* @param string $owner_type
* @param int $version
*/
function my_action_callback ( $owner_type , $version ) {
// Your code here.
}src/domains/custom-fields/services/definitions.php:646
filter
Filters the public schema of a custom field before it is returned.
Parameters of davo_custom_field_schema_response Parameter Type Description $schema array<string, mixed> The schema: field ID, type, name, label, description, placeholder, default value, required, order, section, validation, options, configuration, placement and visibility. $definition array<string, mixed> The full decoded definition.
Returns array<string, mixed>
add_filter Copyadd_filter ( 'davo_custom_field_schema_response' , 'my_filter_callback' , 10 , 2 );
/**
* @param array<string, mixed> $schema
* @param array<string, mixed> $definition
*/
function my_filter_callback ( $schema , $definition ) {
// Change $schema as needed, then return it.
return $schema ;
}src/domains/custom-fields/helpers.php:294
filter
Filters the registered custom field types. Add a type here to make it available.
Parameters of davo_custom_field_types Parameter Type Description $types array<string, array<string, mixed>> Type slug => type definition. Defaults to the built-in types.
Returns array<string, array<string, mixed>>
add_filter Copyadd_filter ( 'davo_custom_field_types' , 'my_filter_callback' , 10 , 1 );
/**
* @param array<string, array<string, mixed>> $types
*/
function my_filter_callback ( $types ) {
// Change $types as needed, then return it.
return $types ;
}src/domains/custom-fields/services/type-registry.php:54
action
Fires after a custom field definition is updated.
Parameters of davo_custom_field_updated Parameter Type Description $field_id string Field's stable ID. $definition array<string, mixed> Updated, decoded definition. $previous array<string, mixed> Definition before this update.
add_action Copyadd_action ( 'davo_custom_field_updated' , 'my_action_callback' , 10 , 3 );
/**
* @param string $field_id
* @param array<string, mixed> $definition
* @param array<string, mixed> $previous
*/
function my_action_callback ( $field_id , $definition , $previous ) {
// Your code here.
}src/domains/custom-fields/services/definitions.php:353
action
Fires after custom field values are explicitly cleared for an object.
Parameters of davo_custom_field_values_cleared Parameter Type Description $owner_type string Owner type slug. $object_id int The owning object's ID. $field_ids array<string> Cleared field IDs.
add_action Copyadd_action ( 'davo_custom_field_values_cleared' , 'my_action_callback' , 10 , 3 );
/**
* @param string $owner_type
* @param int $object_id
* @param array<string> $field_ids
*/
function my_action_callback ( $owner_type , $object_id , $field_ids ) {
// Your code here.
}src/domains/custom-fields/services/values.php:422
action
Fires after every custom field value is deleted for an object.
Parameters of davo_custom_field_values_deleted Parameter Type Description $owner_type string Owner type slug. $object_id int The owning object's ID.
add_action Copyadd_action ( 'davo_custom_field_values_deleted' , 'my_action_callback' , 10 , 2 );
/**
* @param string $owner_type
* @param int $object_id
*/
function my_action_callback ( $owner_type , $object_id ) {
// Your code here.
}src/domains/custom-fields/services/values.php:458
action
Fires after a batch of custom field values is saved for an object.
Parameters of davo_custom_field_values_saved Parameter Type Description $owner_type string Owner type slug. $object_id int The owning object's ID. $validated_values array<string, mixed> field_id => saved value.
add_action Copyadd_action ( 'davo_custom_field_values_saved' , 'my_action_callback' , 10 , 3 );
/**
* @param string $owner_type
* @param int $object_id
* @param array<string, mixed> $validated_values
*/
function my_action_callback ( $owner_type , $object_id , $validated_values ) {
// Your code here.
}src/domains/custom-fields/services/values.php:397
filter
Filters the public schema of an owner type before it is returned.
Only the output handed to visitors passes through here, never the admin builder's data, so it is the safe place to translate labels for the current language.
Parameters of davo_custom_fields_public_schema Parameter Type Description $schema array{fields: array<array<string, mixed>>, sections: array<array<string, mixed>>} Public schema. $owner_type string Owner type slug.
add_filter Copyadd_filter ( 'davo_custom_fields_public_schema' , 'my_filter_callback' , 10 , 2 );
/**
* @param array{fields: array<array<string, mixed>>, sections: array<array<string, mixed>>} $schema
* @param string $owner_type
*/
function my_filter_callback ( $schema , $owner_type ) {
// Change $schema as needed, then return it.
return $schema ;
}src/domains/custom-fields/repository.php:147
action
Fires once at init (priority 5) so a content-type domain can register itself as a Custom Fields owner. See Custom_Fields_Owner_Registry::register()'s docblock for the full registration example.
Parameters of davo_register_custom_field_owner_types Parameter Type Description $registry Custom_Fields_Owner_Registry Shared owner-type registry instance.
add_action Copyadd_action ( 'davo_register_custom_field_owner_types' , 'my_action_callback' , 10 , 1 );
/**
* @param Custom_Fields_Owner_Registry $registry
*/
function my_action_callback ( $registry ) {
// Your code here.
}src/domains/custom-fields/initializer.php:256