Options

Option pages

Create settings screens from PHP while saving only explicitly registered and sanitized fields.

#Complete page

Paste this complete example into the registration file loaded by your theme.

PHP
<?php

defined('ABSPATH') || exit;

use Voxyframe\Core\Registry;

add_action('voxycure/register', function (Registry $registry): void {
    $registry->register_option_page('theme-settings', [
        'name' => 'Theme settings',
        'page_title' => 'Theme settings',
        'option_key' => 'theme_settings',
        'capability' => 'manage_options',
        'icon' => 'dashicons-admin-customizer',
        'position' => 58,
        'autoload' => false,
        'fields' => [
            ['field_key' => 'brand_color', 'label' => 'Brand color', 'type' => 'color'],
            ['field_key' => 'support_email', 'label' => 'Support email', 'type' => 'text'],
        ],
    ]);
});

#Save security

The REST route rejects unregistered option keys, checks the page capability, ignores unregistered fields, validates required values, sanitizes by field type, and then calls update_option().

#Read an option

PHP
$color = voxycure_get_option('theme_settings.brand_color', '#1d49c3');
Framework version2.0.0
PHP requirement8.0+
Documentation updatedAugust 2026