Docs/Developer Guide/PHP APIs
PHP APIs
TPMeta_Options is the static facade behind every option panel, whether it was registered in code or built visually — the builder calls the same methods documented here. For the front-end read helpers (tpmeta_get_option, tpmeta_field, etc.), see Helper Functions.
TPMeta_Options — public methods
| Method | Purpose |
|---|---|
set_args( $opt_name, $args ) | Registers a panel's top-level settings (menu, capability, Customizer integration…). Call once per panel. |
set_section( $opt_name, $section ) | Adds a section (tab) of fields to a panel. Call once per section. |
get_panels() | Returns every registered panel's config, keyed by opt_name. |
get_panel( $opt_name ) | Returns one panel's config. |
get_sections( $opt_name ) | Returns a panel's sections. |
get_fields( $opt_name ) | Returns every field definition in a panel, flattened across sections. |
get_field( $opt_name, $field_id ) | Returns one field's definition. |
get_default( $field_id ) | Returns a field's configured default value by ID. |
set_args() — common keys
| Key | Type | Purpose |
|---|---|---|
menu_title / page_title | string | Labels for the admin menu and page. |
capability | string | WordPress capability required to view/save (default manage_options). |
output_css | bool | Auto-print CSS from fields that declare an output rule. |
customizer_integration | bool | Mirror the panel into Appearance → Customize. See Integrations → Options Pages. |
A full worked example registering a panel with a section and a field: Creating Field Groups.
Everything is registered on init
Call set_args() / set_section() inside an init action at priority 5 or earlier than the builder loader — otherwise the admin menu never appears.