array( 'type' => 'string', 'description' => __( 'Field name (e.g. hero_title) or field key (e.g. field_abc123). The name is what you see in the ACF admin.', 'acrossai-abilities-manager' ), ), ); } protected function required_input(): array { return array( 'selector', ); } protected function output_properties(): array { return array( 'deleted' => array( 'type' => 'boolean' ), ); } protected function annotations(): array { return array( 'readonly' => false, 'destructive' => true, 'idempotent' => true, ); } protected function run( array $input ) { $target = Acf_Target::resolve( $input ); if ( is_wp_error( $target ) ) { return $target; } $selector = (string) $input['selector']; if ( ! Field_Repository::exists( $selector, $target ) ) { return new \WP_Error( 'unknown_field', sprintf( /* translators: %s: field name */ __( 'No ACF field "%s" is attached to that target.', 'acrossai-abilities-manager' ), $selector ) ); } $deleted = Field_Repository::delete( $selector, $target ); if ( is_wp_error( $deleted ) ) { return $deleted; } return array( 'deleted' => true, 'message' => sprintf( /* translators: 1: field name, 2: target description */ __( 'Cleared "%1$s" on %2$s.', 'acrossai-abilities-manager' ), $selector, Acf_Target::describe( $input ) ), ); } }