/wpapp:wpappfrom wpapp
Build WordPress web applications with the WpApp framework: scaffolding plugins, defining routes, configuring masterbar/access control, and managing database schema.
Ships in wpapp. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
WpApp builds web applications on WordPress with routing, theme isolation, admin bar integration, and admin color scheme tokens.
Scaffold a new WpApp plugin:
composer create-project akirk/create-wp-app my-app
This prompts for plugin name, namespace, author, URL path, and setup type. The default setup type is Full, which creates a BaseApp scaffold. Choose Minimal only for a small direct WpApp setup.
Full setup creates:
my-app/
├── my-app.php # Main plugin file
├── src/
│ └── App.php # BaseApp subclass with lifecycle hooks
├── templates/
│ └── index.php # Main route template
├── composer.json
└── .gitignore
Minimal setup creates:
my-app/
├── my-app.php # Main plugin file with WpApp initialization
├── templates/
│ └── index.php
├── composer.json
└── .gitignore
__construct() focused on creating/configuring WpApp, assigning storage objects, and attaching WordPress hooks.register_post_type(), register_taxonomy(), flush_rewrite_rules(), wp_add_dashboard_widget(), REST route registration, or other WordPress-hooked feature registration directly from __construct().init hook.show_in_rest => true (the block editor needs it), wire its rest_controller_class to \WpApp\Rest\Access::protect_post_type() / ::protect_taxonomy() — that gates its REST reads to the app's capability. Otherwise published entries are readable anonymously over /wp/v2/<type> regardless of public => false. See docs/access-control.md. (Requires akirk/wp-app ^1.5.)wp_dashboard_setup hook.setup_routes() and WpApp menu/masterbar entries in setup_menu().$app = new WpApp( __DIR__ . '/templates', 'my-app' );
$app->init();
use WpApp\BaseApp;
use WpApp\WpApp;
class App extends BaseApp {
public function __construct() {
$this->app = new WpApp( $this->get_template_dir(), $this->get_url_path(), [
'require_login' => true,
'app_name' => 'My App',
] );
add_action( 'init', [ $this, 'register_post_types' ] );
}
protected function get_url_path(): string {
return 'my-app';
}
protected function get_template_dir(): string {
return dirname( __DIR__ ) . '/templates';
}
protected function setup_database(): void {}
protected function setup_routes(): void {
$this->app->route( 'dashboard' );
$this->app->route( 'user/{user_id}' );
}
protected function setup_menu(): void {
$this->app->add_menu_item( 'dashboard', 'Dashboard', home_url( '/my-app/dashboard' ) );
}
}
A show_in_rest post type is readable anonymously over /wp/v2/<type> unless its
REST reads are gated (front-end require_login does not cover REST). Set each
type's rest_controller_class to Access::protect_*, which records the capability
and returns the gated controller class:
use WpApp\Rest\Access;
public function register_post_types(): void {
register_post_type( 'note', [
'public' => false,
'show_in_rest' => true,
'rest_controller_class' => Access::protect_post_type( 'note', 'read' ),
'supports' => [ 'title', 'editor', 'author', 'custom-fields' ],
] );
register_taxonomy( 'note_tag', 'note', [
'public' => false,
'show_in_rest' => true,
'rest_controller_class' => Access::protect_taxonomy( 'note_tag', 'read' ),
] );
}
$app->route( 'user/{user_id}' ); // templates/user.php
$app->route( 'posts/{id}/edit' ); // templates/posts-edit.php
Access in template: $user_id = get_query_var( 'user_id' );
$app->route( 'admin', 'admin.php', [], 'manage_options' );
BaseStorage only when native WordPress storage does not fit, such as high-volume rows, relational data, or records that do not map cleanly to posts, terms, or users.BaseStorage, instantiate the storage class during app construction and call create_tables() during plugin activation.class Storage extends BaseStorage {
// Keyed by unprefixed table name; create_tables() adds the prefix and
// wraps each definition in CREATE TABLE with the site's charset.
protected function get_schema() {
return [
'myapp_items' => "id bigint(20) unsigned NOT NULL AUTO_INCREMENT,
user_id bigint(20) unsigned NOT NULL,
data longtext,
PRIMARY KEY (id),
KEY user_id (user_id)",
];
}
}
Keep CSS and JavaScript in asset files loaded through the scoped enqueue helpers. Do not write inline <style> or <script> blocks, style attributes, or event-handler attributes in app templates. Pass dynamic values through HTML data attributes for an external script to read.
<!DOCTYPE html>
<html <?php wp_app_language_attributes(); ?>>
<head>
<title><?php wp_app_the_title( 'Page' ); ?></title>
<?php wp_app_head(); ?>
</head>
<body>
<?php wp_app_body_open(); ?>
<!-- content -->
<?php wp_app_body_close(); ?>
</body>
</html>
| Option | Default | Description |
|---|---|---|
app_name | Auto-generated from URL path | Display name for your app in the admin bar |
require_login | true | Require authentication (set false for a public app) |
require_capability | null | Required WordPress capability (overrides require_login; implies login) |
show_masterbar_for_anonymous | true | Show nav for logged-out users |
show_wp_logo | true | Show WordPress logo |
show_site_name | true | Show site name |
admin_bar_app_link | true | Add app entry to admin bar |
clear_admin_bar | false | Remove all WP admin bar items |
launcher | true | Register with My Apps / OpenStation (false, true, or a launcher name; my_apps is the old name) |
app_icon | null | URL to an app icon or Dashicon class (my_apps_icon is the old name) |
app_icon_background | null | Tile colour or gradient behind a Dashicon/letter icon, e.g. linear-gradient(135deg, #1e3c72, #2a5298) |
app_icon_color | null | Glyph colour for a Dashicon/letter icon, e.g. #fff |
app_icon_shadow | null | true for a soft glyph shadow, or a CSS text-shadow value |
Plain Dashicons on the default white tile look generic; always pair a Dashicon with app_icon_background and app_icon_color.
Use admin color variables in app CSS instead of hard-coding WordPress admin colors:
.button-primary {
background: var(--wp-app-color-primary);
color: var(--wp-app-color-on-primary);
}
.button-primary:hover {
background: var(--wp-app-color-primary-hover);
}
Pair background and text tokens so light/dark mode can switch both sides together:
--wp-app-color-background with --wp-app-color-text--wp-app-color-surface with --wp-app-color-text--wp-app-color-surface-alt with --wp-app-color-muted or --wp-app-color-text--wp-app-color-primary with --wp-app-color-on-primary--wp-app-color-secondary with --wp-app-color-secondary-textAvoid mixing tokenized colors with hard-coded colors such as #fff, #222, or white, because the hard-coded side will not adapt when the app switches between light and dark mode.
$app->add_menu_item( 'id', 'Label', $url ); // Submenu under app
$app->add_top_level_menu_item( 'id', 'Label', $url ); // Top-level
$app->add_user_menu_item( 'id', 'Label', $url ); // User dropdown
Expose the app's data through the WordPress Abilities API so assistants, automation and other apps can use it without reading the code. Register categories on wp_abilities_api_categories_init and abilities on wp_abilities_api_init, guarded by function_exists( 'wp_register_ability' ). Use the app's route slug as namespace and category (community/list-posts) and reuse $app->get_required_capability() in permission_callback. Leave meta.public unset: the permission callback is the gate, and AI Assistant / MCP Connect expose the ability to signed-in users who pass it.
Design rules — the description and schemas are the whole API for the caller:
list-posts, get-post, create-post); never an action switch or a run-anything escape hatch.additionalProperties: false; closed sets use enum; always give output_schema.readonly, destructive, idempotent.WP_Error with stable codes (not_found), never false/null/[].list-* pages (page, per_page with a maximum) and returns summaries; get-* returns the full record.Full guidance and a worked example: docs/abilities.md and the community-app example.
For comprehensive guides, see the docs/ directory:
docs/getting-started.md - Installation and quick startdocs/configuration.md - All configuration optionsdocs/routing.md - URL patterns and parametersdocs/masterbar.md - Admin bar customizationdocs/access-control.md - Capabilities and rolesdocs/baseapp.md - BaseApp and BaseStorage patternsdocs/abilities.md - Exposing the app through the Abilities API and designing good abilitiesWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
wordpress, wpapp, plugin-development, routing, access-control
Generated from the plugin's indexed repository (akirk/wp-app) — no native marketplace selected
npx claudepluginhub p/akirk-wpappOther plugins' skills for the same job