/localwp-shell:localwp-shellfrom localwp-shell
Runs wp/php/mysql/composer commands through LocalWP's sandboxed environment when inside a LocalWP site, fixing 'command not found', wrong PHP version, opcache/xdebug load failures, and MySQL socket errors.
Ships in localwp-shell. 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.
Read when SKILL.md points to them; scripts run unread.
Platform: macOS only.
Run commands through LocalWP's sandboxed environment (PHP, MySQL, WP-CLI, Composer). Auto-detects the correct LocalWP site from the current working directory, including through symlinked app/public directories and project directories whose contents symlink into a site tree (e.g. myproject/links/theme -> ~/Sites/wp-site/wp-content/themes/x — the script follows the project's symlinks, finds the site, and runs commands from its WordPress root).
All scripts live in this skill's directory. Resolve that directory at every independent shell block, then run them with bash:
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
# WP-CLI (most common) — silent by default
bash "$SKILL_DIR/scripts/wplocal" plugin list
bash "$SKILL_DIR/scripts/wplocal" search-replace 'old.test' 'new.test'
bash "$SKILL_DIR/scripts/wplocal" db export backup.sql
# PHP, Composer, MySQL — full env with version info
bash "$SKILL_DIR/scripts/localwpshell" php -v
bash "$SKILL_DIR/scripts/localwpshell" composer install
bash "$SKILL_DIR/scripts/localwpshell" mysql -e "SHOW DATABASES;"
# Silent mode — only command output, no env info
bash "$SKILL_DIR/scripts/silentlocalwpshell" php -r 'echo PHP_VERSION;'
| Command | Purpose |
|---|---|
$SKILL_DIR/scripts/localwpshell [cmd] | Load LocalWP env, show versions, optionally run a command |
$SKILL_DIR/scripts/silentlocalwpshell [cmd] | Same as above but suppresses info output |
$SKILL_DIR/scripts/wplocal [wp-args] | Shorthand for silentlocalwpshell wp ... |
Always wrap commands through these scripts when the working directory is inside a LocalWP site. The system PHP/MySQL on macOS is not the same as what LocalWP provisions.
Local Sites/app/public/wp-content/NEVER source a LocalWP ssh-entry script directly (source "~/Library/Application Support/Local/ssh-entry/XXX.sh"). It launches an interactive shell that blocks the agent indefinitely. Always go through localwpshell / silentlocalwpshell / wplocal, which extract the environment without spawning a shell.
WordPress Multisite: always pass --url=. On a multisite install, WP-CLI without --url targets the network's primary site — pages, options, and plugin changes land on the WRONG site silently. Find the right URL first (wp site list), then include it in every command:
# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
bash "$SKILL_DIR/scripts/wplocal" site list
bash "$SKILL_DIR/scripts/wplocal" post list --post_type=page --url=https://wp.wpengine/coaching
Error: Failed loading /opt/...opcache.so or xdebug.so — wrong PHP binaryERROR 2002 (HY000): Can't connect to local MySQL server through socket — wrong MySQLPHP Fatal error: Uncaught Error: Call to undefined function ... — missing PHP extensionwp: command not found — WP-CLI not on PATH# Codex: this path resolves under Claude Code; substitute the directory containing this SKILL.md.
SKILL_DIR="${CLAUDE_SKILL_DIR}"
# Instead of: Use:
wp plugin list bash "$SKILL_DIR/scripts/wplocal" plugin list
php -v bash "$SKILL_DIR/scripts/localwpshell" php -v
composer install bash "$SKILL_DIR/scripts/localwpshell" composer install
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Other plugins' skills for the same job
npx claudepluginhub jtsternberg/claude-plugins --plugin localwp-shell