Agent skill
wp-settings-page
Create WordPress admin settings pages with Settings API.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/data/wp-settings-page
SKILL.md
WP Settings Page
Instructions
When creating admin settings pages for the plugin:
- Register setting: Use
register_setting()for storage - Add settings section:
add_settings_section() - Add settings fields:
add_settings_field() - Create options page:
add_options_page() - Sanitize input: Use callback to clean data
Pattern
// Register setting
register_setting('retrologin_options', 'retrologin_settings');
// Add section
add_settings_section('retrologin_general', 'General Settings', 'retrologin_section_cb', 'retrologin');
// Add field
add_settings_field('retrologin_color', 'Retro Color', 'retrologin_color_cb', 'retrologin', 'retrologin_general');
// Add menu page
add_options_page('RetroLogin Settings', 'RetroLogin', 'manage_options', 'retrologin', 'retrologin_options_page');
Options Page Structure
function retrologin_options_page(): void {
?>
<div class="wrap">
<h1>RetroLogin Settings</h1>
<form action="options.php" method="post">
<?php
settings_fields('retrologin_options');
do_settings_sections('retrologin');
submit_button();
?>
</form>
</div>
<?php
}
Sanitization
function retrologin_sanitize($input): array {
$sanitized = [];
if (isset($input['color'])) {
$sanitized['color'] = sanitize_text_field($input['color']);
}
return $sanitized;
}
Guidelines
- Use single option array for related settings
- Always sanitize on save
- Use capabilities check:
manage_options - Store defaults on plugin activation
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?