Skip to content

Settings & Configuration

Harish Dhanraj Sugandhi edited this page Mar 4, 2026 · 1 revision

Settings & Configuration

All settings are managed by inc/Core/Settings.php and stored in the openwp_settings WordPress option.

Default Settings

[
    // Provider Configuration
    'default_provider'           => 'openrouter',
    'default_model_openai'       => 'gpt-5.2',
    'default_model_anthropic'    => 'claude-3-5-sonnet-latest',
    'default_model_glm'          => 'glm-5',
    'default_model_openrouter'   => 'anthropic/claude-sonnet-4-5',

    // Operational Limits
    'log_retention_days'         => 90,
    'timeout_seconds'            => 45,
    'max_actions_user_day'       => 50,
    'max_actions_site_day'       => 500,
    'max_tokens_user_day'        => 120000,
    'max_tokens_site_day'        => 1200000,
    'min_seconds_between_runs'   => 5,

    // Safety Controls
    'kill_switch'                => false,
    'medium_requires_approval'   => false,
    'high_requires_approval'     => false,
    'critical_requires_approval' => false,

    // Features
    'openwp_memory_enabled'      => true,

    // Content Generation
    'theme_palette'               => ['#4F46E5', '#7C3AED', '#F59E0B', '#1E1B4B', '#EEF2FF', '#C7D2FE'],
    'editor_default_content_type' => 'hero_section',
    'editor_default_tone'         => 'professional',
]

Settings API

// Get all settings (merged with defaults)
$settings = Settings::get();

// Update settings (merge with existing)
$merged = Settings::update(['kill_switch' => true]);

// Get action policies
$policies = Settings::get_action_policy();

// Update action policies
Settings::update_action_policy(['wp_delete_post' => ['enabled' => false]]);

// Get provider status (masked keys)
$status = Settings::provider_status();
// → ['has_openai_key' => true, 'masked_keys' => ['openai' => '...k3Af']]

// Get MCP settings
$mcp = Settings::get_mcp_settings();

// Update MCP settings
Settings::update_mcp_settings(['enabled' => true, 'modules' => ['woo' => false]]);

Content Types

Valid content types for the editor block:

Type Description
hero_section Landing page hero
feature_section Feature highlights
faq_section FAQ accordion
cta_section Call to action
blog_intro Blog introduction
testimonials_section Customer testimonials
pricing_section Pricing tables
about_section About us content
newsletter_section Newsletter signup
contact_section Contact information
full_landing_page Complete landing page
full_blog_post Full blog post
full_about_page Complete about page
full_services_page Services page
full_contact_page Contact page

Tone Options

Tone Description
professional Corporate, polished
friendly Warm, approachable
persuasive Sales-oriented
casual Relaxed, informal
technical Developer-focused

MCP Module Defaults

[
    'core'     => true,    // 39 tools - Core WordPress operations
    'woo'      => true,    // 25 tools - WooCommerce (if available)
    'plugin'   => true,    // 13 tools - Plugin management
    'theme'    => true,    // 13 tools - Theme management
    'db'       => true,    // 1 tool  - Database queries
    'polylang' => true,    // 11 tools - Polylang (if available)
]

Input Sanitization

Settings are sanitized on save:

Type Keys Sanitization
Provider default_provider Must be in allowed list
Model strings default_model_* sanitize_text_field()
Integers timeout_seconds, max_*, etc. max(1, absint())
Booleans kill_switch, *_requires_approval rest_sanitize_boolean()
Palette theme_palette sanitize_hex_color(), max 7 colors
Content type editor_default_content_type Must be in allowed list
Tone editor_default_tone Must be in allowed list

WordPress Options

Option Key Content
openwp_settings Main settings array
openwp_provider_keys Encrypted API keys
openwp_action_policies Per-action policy overrides
openwp_rate_limits Rate limit configuration
openwp_db_version Current DB schema version
openwp_onboarding_completed Onboarding completion flag
openwp_do_redirect Post-activation redirect flag
openwp_onboarding_progress Onboarding step progress
openwp_mcp_enabled MCP server on/off
openwp_mcp_bearer_token Encrypted MCP auth token
openwp_mcp_debug_mode MCP debug mode flag
openwp_mcp_modules MCP module toggles

Clone this wiki locally