For the complete documentation index, see llms.txt. This page is also available as Markdown.

save_acpt_meta_field

Create or update a meta field

Create or update a meta field.

Usage

save_acpt_meta_field([
    'group_name'    => 'group',
    'box_name'      => 'box',
    'name'          => 'price',
    'label'         => 'Price',
    'type'          => 'Number',
    'show_in_archive' => false,
    'is_required'   => false,
    'default_value' => '0',
    'description'   => 'Product price in USD',
    'advanced_options' => [
        ['key' => 'min',  'value' => '0'],
        ['key' => 'max',  'value' => '9999'],
        ['key' => 'step', 'value' => '0.01'],
    ],
]);

Parameters

Parameter
Type
Required
Description

group_name

string

Required

The field group name. Also accepted as groupName

box_name

string

Required

The meta box name. Also accepted as boxName

name

string

Required

The field name (slug)

type

string

Required

The field type — see field types for the full list

new_name

string

Optional

The new field name when renaming an existing field

label

string

Optional

The human-readable field label

show_in_archive

boolean

Optional

Show the field value in the admin post list. Defaults to false

is_required

boolean

Optional

Make the field required in the edit screen. Defaults to false

quick_edit

boolean

Optional

Enable inline editing in the admin post list. Defaults to false

filterable_in_admin

boolean

Optional

Make the field a filter in the admin post list. Defaults to false

default_value

string

Optional

The default field value

description

string

Optional

Help text shown below the field

options

array

Optional

Predefined options (Select, Select Multi, Checkbox, and Radio fields only)

advanced_options

array

Optional

Array of {key, value} pairs for advanced field settings such as min, max, step, pattern, before, after

validation_rules

array

Optional

Array of validation rule definitions

visibility_conditions

array

Optional

Array of conditional rendering rules

relations

array

Optional

Relation configuration (Relational fields only)

children

array

Optional

Array of nested field definitions (Repeater fields only)

blocks

array

Optional

Array of nested block definitions (Flexible Content fields only)

Return

Type
Description

bool

true on success, false on failure

Last updated