Cybo Advanced Field EngineCyboweb Technologies · Documentation · v1.0.2

cafe_delete_field()

Purpose

Deletes the saved value of a field for one object.

Syntax

cafe_delete_field( string $selector, mixed $object_id = null, ?string $object_type = null ): bool

Parameters

Parameter Type Default Description
$selector string - Field name or field key.
$object_id mixed null Which object. null means the current object.
$object_type string|null null Object type, or null to infer it.

Return value

true when the value is gone (also when nothing was saved), false when the field or object cannot be found or the database fails.

Example

cafe_delete_field(
	'hero_title',
	$post_id
);

Notes

  • Deletes the value only; the field definition stays.
  • Fires cafe_before_delete_field and cafe_after_delete_field.
  • When WordPress deletes a post, term, user or comment, CAFE removes its values automatically: you do not need to call this.