---
title: Action Button
description: "Renders a button that triggers a custom action handler. The field does not store a value; it only provides a UI trigger with optional confirmation and lockout. ## Use Cases - Run a manual sync task from an edit screen…"
url: "https://racmanuel.dev/docs/custom-fields-booster/action-button/"
updated: "2026-02-24"
category: Custom Fields Booster
tags:
  - Free
---

# Action Button

Renders a button that triggers a custom action handler.

The field does not store a value; it only provides a UI trigger with optional confirmation and lockout.

## Use Cases

- Run a manual sync task from an edit screen
- Trigger a background job for a specific entry
- Launch a custom maintenance action
- Execute a one-off export for a post
- Perform a custom workflow step in admin

## Field Preview

A primary button with optional confirmation, plus a spinner and message area.

## How to Use

1. Add the Action Button field to a Field Group.
2. Set **Button label** and **Action slug**.
3. (Optional) Enable confirmation and set the message.
4. (Optional) Set a required capability.
5. Set **Lock seconds** to prevent rapid repeats.
6. Save the Field Group and use the button in the editor.

## Field Settings

| Setting | Description | Default |
| --- | --- | --- |
| Button label | Text displayed on the button | Run action |
| Action slug | Unique identifier for the action | Empty |
| Enable confirmation | Show a confirmation prompt | 0 |
| Confirmation message | Message shown in the confirmation prompt | Are you sure? |
| Required capability | Optional capability check | Empty |
| Lock seconds | Prevents rapid repeated triggers | 15 |

## Value & Storage

Saved as: Post meta (no value)

Storage type: null

Return format: null

REST format: not specified

Important details:

- This field does not store any value.
- Output from `get_field()` is always `null`.

## Output Examples

### PHP

```php
$value = get_field('my_action_button');
if ($value === null) {
    // No stored value for this field.
}
```

## Compatibility

- Repeaters
- Flexible Content
- Options Pages
- Frontend forms (acf_form)
- REST API
- Multisite

## Hooks (Developer)

### Hooks Summary

| Hook | Type | Purpose |
| --- | --- | --- |
| custom_fields_booster_button_action_defaults | Filter | Modify default settings. |
| custom_fields_booster_button_action_supports | Filter | Modify ACF support flags. |
| custom_fields_booster_button_action_before_settings | Action | Run logic before rendering settings UI. |
| custom_fields_booster_button_action_after_settings | Action | Run logic after rendering settings UI. |
| custom_fields_booster_button_action_before_enqueue | Action | Run logic before enqueuing assets. |
| custom_fields_booster_button_action_after_enqueue | Action | Run logic after enqueuing assets. |
| custom_fields_booster_button_action_before_render | Action | Run logic before rendering UI. |
| custom_fields_booster_button_action_after_render | Action | Run logic after rendering UI. |
| custom_fields_booster_button_action_update_value | Filter | Modify the value before saving. |
| custom_fields_booster_button_action_load_value | Filter | Modify the value after loading. |
| custom_fields_booster_button_action_validate_value | Filter | Modify validation result. |
| custom_fields_booster_button_action_format_value | Filter | Modify value returned by `get_field()`. |

### Filters

**Filter:** `custom_fields_booster_button_action_defaults`

Purpose: Override default settings.

When: You want consistent defaults across all Action Button fields.

```php
add_filter('custom_fields_booster_button_action_defaults', function ($defaults) {
    $defaults['lock_seconds'] = 30;
    return $defaults;
});
```

**Filter:** `custom_fields_booster_button_action_supports`

Purpose: Control ACF supports such as required or escaping behavior.

When: Your project needs different support flags.

```php
add_filter('custom_fields_booster_button_action_supports', function ($supports) {
    $supports['required'] = false;
    return $supports;
});
```

**Filter:** `custom_fields_booster_button_action_update_value`

Purpose: Modify the value before saving.

When: You want to modify the stored output (always `null` by default).

```php
add_filter('custom_fields_booster_button_action_update_value', function ($value, $post_id, $field, $field_instance) {
    return $value;
}, 10, 4);
```

**Filter:** `custom_fields_booster_button_action_load_value`

Purpose: Modify the value after loading.

When: You want to customize the returned value.

```php
add_filter('custom_fields_booster_button_action_load_value', function ($value, $post_id, $field, $field_instance) {
    return $value;
}, 10, 4);
```

**Filter:** `custom_fields_booster_button_action_validate_value`

Purpose: Modify validation result.

When: You need custom validation logic.

```php
add_filter('custom_fields_booster_button_action_validate_value', function ($valid, $value, $field, $input, $field_instance) {
    return $valid;
}, 10, 5);
```

**Filter:** `custom_fields_booster_button_action_format_value`

Purpose: Modify value returned by `get_field()`.

When: You want to change the return value.

```php
add_filter('custom_fields_booster_button_action_format_value', function ($value, $post_id, $field, $field_instance) {
    return $value;
}, 10, 4);
```

### Actions

**Action:** `custom_fields_booster_button_action_before_render`

Runs before rendering the field UI.

```php
add_action('custom_fields_booster_button_action_before_render', function ($field, $field_instance) {
    // Pre-render logic.
}, 10, 2);
```

**Action:** `custom_fields_booster_button_action_after_render`

Runs after rendering the field UI.

```php
add_action('custom_fields_booster_button_action_after_render', function ($field, $field_instance) {
    // Post-render logic.
}, 10, 2);
```

## Assets

This field enqueues scripts whenever the input is rendered (admin and frontend via `acf_form()`):

- `admin/js/cfb-field-button-action.js`

## REST API

Schema: not specified

## REST Validation

Standard ACF validation only.

## Security & Escaping

- Output escapes all attributes and the button label.
- No value is saved or formatted.

## Notes / Limitations

- This field requires a custom handler for the action slug (client/server).

## Changelog

- 1.0.0 — Initial release
