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

save_acpt_meta_group

Create or update a field group

Create or update a field group, including its boxes and fields.

Performs an upsert: if a group with the given name already exists (and no id is passed), its existing state is merged with the ones you provide — a partial update (e.g. belongs only) doesn't wipe boxes/fields you didn't resend.

Usage

save_acpt_meta_group([
    'name'    => 'new-group',
    'label'   => 'New group',
    'display' => 'horizontalTabs',
    'belongs' => [
        [
            'belongsTo' => 'customPostType',
            'operator'  => '=',
            'find'      => 'page',
        ],
    ],
    'boxes' => [
        [
            'name'   => 'box',
            'label'  => 'Box',
            'fields' => [
                [
                    'name'  => 'field',
                    'label' => 'Field',
                    'type'  => 'Text',
                ],
            ],
        ],
    ],
]);

To rename an existing group, include new_name:

Parameters

Parameter
Type
Required
Description

name

string

Required

The group name (slug)

id

string

Optional

Group UUID — if provided, updates the existing group instead of resolving it by name

new_name

string

Optional

The new group name when renaming an existing group

label

string

Optional

The human-readable group label

display

string

Optional

How to render the group. Allowed values: standard, accordion, verticalTabs, horizontalTabs

belongs

array

Optional

Location rules controlling which WordPress context displays this group — see below

boxes

array

Optional

The group's meta boxes, each containing its own fields — see below

belongs rule fields

Field
Type
Description

belongsTo

string

One of PARENT_POST_ID, POST_ID, POST_CAT, POST_TAX, POST_TEMPLATE, TERM_ID, USER_ID, comment, customPostType, taxonomy, media, optionPage, user

operator

string

One of =, !=, <, >, <=, >=, LIKE, NOT_LIKE, IN, NOT_IN, NULL, NOT_NULL, BLANK, NOT_BLANK, CHECKED, NOT_CHECKED

find

string

The target value (e.g. a post type slug) — not needed for every operator

logic

string

AND or OR, when combined with other rules

boxes[] fields

Field
Type
Description

name

string

Required. The box name (slug)

label

string

The human-readable box label

fields

array

The box's fields — see save_acpt_meta_field for the full field object structure (name, type, options, advancedOptions, validationRules, visibilityConditions, relations, children, blocks, etc.)

For adding, updating, or removing a single box or field without resending the whole group, prefer save_acpt_meta_box / save_acpt_meta_field — they handle the merge-with-existing-state logic for you.

Return

Type
Description

bool

true on success, false on failure

Last updated