Creating an option page
Pro
Click Create on Option Pages, give the page a label, and choose a Key. Then give a fieldset an Option Page Location that selects the page. Its fields appear the next time you open the page.
The key
The key identifies the page's stored values and its menu URL, and you can't change it later.
- Up to 32 characters: lowercase letters, numbers, hyphens and underscores.
- It can't start with an underscore, and
coreis reserved.
Menu placement
The page's settings decide where it appears in the wp-admin menu:
- Menu type: a Top-level menu item (the default), a Submenu of another item (under VX, under a WordPress menu such as Settings, or under a post type), or Hidden (URL only), reachable only by its address.
- Menu title and Menu position: the menu label, if it should differ from the page label, and where a top-level item sits.
- Icon and Accent color: how it looks in the menu and on the page.
Who can edit it
Capability decides who can open the page and save its values. It defaults to manage_options (administrators). Set it to, for example, edit_others_posts to let Editors update the opening hours without giving them anything else.
Designing the page itself, in the VX dashboard, stays limited to administrators.
Autoload
Autoload values is on by default: WordPress loads the page's values into memory on every request, which is fast when your theme reads them on most pages. Turn it off for large or rarely used pages, such as an import settings screen.
Inactive and deleted pages
- Inactive removes the page from the menu. Its settings and saved values are kept.
- Delete removes the page and permanently deletes every value saved on it, and it removes the page from every fieldset's Locations.
Warning
Deleting an option page is the one delete in VX that removes content. Deleting a fieldset or a post type leaves stored values behind; deleting an option page doesn't. Export the values or deactivate the page instead if you might need them.
Related
Technical details for LLMs
- Config keys:
label(max 200),description,icon/icon_svg,accent_color,menu_type(top_level|submenu|hidden, defaulttop_level),parent_slug(defaultvx-framework),menu_title,menu_position(int ≥ 0),capability(defaultmanage_options),autoload(default true),active(default true). - Key rules:
^[a-z0-9_-]+$, max 32, no leading_, notcore, unique. - Storage: one option row per page,
vx_option_values:<page_key>, holding every field's value keyed by field key. - Delete (
vx-framework/delete-option-page): deletes the values option, strips the page from fieldset locations, removes relations that named the page; firesvxframework/option_page/before_delete. Refused when the page is code-owned. - Abilities:
vx-framework/create-option-page,vx-framework/update-option-page,vx-framework/list-option-pages,vx-framework/get-option-page.