wordpress-content-manager

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

WordPress Content Manager

WordPress 内容管理器

Manage WordPress posts via the REST API. Fully configurable via environment variables - no manual file editing required.
通过REST API管理WordPress文章。可通过环境变量完全配置——无需手动编辑文件。

Required Environment Variables

必需的环境变量

Before using this skill, the agent must ensure these environment variables are set. If any are missing, ask the user for the values and set them before proceeding.
VariableDescriptionExample
WP_SITE_URL
WordPress site base URL
https://blog.example.com
WP_USERNAME
WordPress username
admin
WP_APP_PASSWORD
WordPress Application Password
xxxx xxxx xxxx xxxx
How to get an Application Password:
  1. Log in to WordPress admin
  2. Go to Users → Profile
  3. Scroll to "Application Passwords"
  4. Enter a name and click "Add New Application Password"
  5. Copy the generated password (spaces are optional)
使用此工具前,需确保已设置以下环境变量。若有缺失,请向用户询问对应值并设置后再继续
变量名描述示例
WP_SITE_URL
WordPress站点基础URL
https://blog.example.com
WP_USERNAME
WordPress用户名
admin
WP_APP_PASSWORD
WordPress应用密码
xxxx xxxx xxxx xxxx
如何获取应用密码:
  1. 登录WordPress后台
  2. 进入 用户 → 个人资料
  3. 滚动到“应用密码”区域
  4. 输入名称并点击“添加新应用密码”
  5. 复制生成的密码(空格可选)

Optional Environment Variables

可选环境变量

VariableDescriptionDefault
WP_API_URL
REST API base URL
{WP_SITE_URL}/wp-json/wp/v2
变量名描述默认值
WP_API_URL
REST API基础URL
{WP_SITE_URL}/wp-json/wp/v2

First-Time Setup

首次设置

Run the setup script after setting the required environment variables. It installs Node.js dependencies and validates the connection.
设置好必需的环境变量后,运行设置脚本。它会安装Node.js依赖并验证连接。

Linux/macOS

Linux/macOS

bash
export WP_SITE_URL="https://your-site.com"
export WP_USERNAME="your-username"
export WP_APP_PASSWORD="your-app-password"
bash ~/.claude/skills/wordpress-content-manager/scripts/setup.sh
bash
export WP_SITE_URL="https://your-site.com"
export WP_USERNAME="your-username"
export WP_APP_PASSWORD="your-app-password"
bash ~/.claude/skills/wordpress-content-manager/scripts/setup.sh

Windows (PowerShell)

Windows (PowerShell)

powershell
$env:WP_SITE_URL = "https://your-site.com"
$env:WP_USERNAME = "your-username"
$env:WP_APP_PASSWORD = "your-app-password"
pwsh ~/.claude/skills/wordpress-content-manager/scripts/setup.ps1
If using Codex CLI, replace
~/.claude/skills
with
~/.codex/skills
.
If Node.js is missing, the setup script will attempt to install it using common package managers.
powershell
$env:WP_SITE_URL = "https://your-site.com"
$env:WP_USERNAME = "your-username"
$env:WP_APP_PASSWORD = "your-app-password"
pwsh ~/.claude/skills/wordpress-content-manager/scripts/setup.ps1
如果使用Codex CLI,请将
~/.claude/skills
替换为
~/.codex/skills
若缺少Node.js,设置脚本会尝试通过常用包管理器进行安装。

Commands

命令

All commands are non-interactive and return JSON when
--json
is set.
所有命令均为非交互式,当添加
--json
参数时会返回JSON格式结果。

Describe Connection

查看连接信息

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs site info --json
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs site info --json

List or Search Posts

列出或搜索文章

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts list --status publish --search "keyword" --per_page 20 --page 1
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts list --status publish --search "keyword" --per_page 20 --page 1

View a Post

查看单篇文章

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts get 123 --json
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts get 123 --json

Create a Post (HTML or Markdown)

创建文章(HTML或Markdown格式)

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts create \
  --title "New Post" \
  --content-file ./post.md \
  --status draft \
  --categories 1,2 \
  --tags 5,7
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts create \
  --title "New Post" \
  --content-file ./post.md \
  --status draft \
  --categories 1,2 \
  --tags 5,7

Schedule a Post

定时发布文章

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts create \
  --title "Scheduled Post" \
  --content "<p>HTML body</p>" \
  --status future \
  --date "2025-01-15T15:30:00"
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts create \
  --title "Scheduled Post" \
  --content "<p>HTML body</p>" \
  --status future \
  --date "2025-01-15T15:30:00"

Update a Post

更新文章

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts update 123 \
  --title "Updated Title" \
  --status publish
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts update 123 \
  --title "Updated Title" \
  --status publish

Delete a Post

删除文章

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts delete 123
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts delete 123

Bulk Delete (Dry-Run First)

批量删除(先试运行)

bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts delete-many \
  --status draft \
  --search "test" \
  --dry-run

node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts delete-many \
  --status draft \
  --search "test" \
  --confirm
bash
node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts delete-many \
  --status draft \
  --search "test" \
  --dry-run

node ~/.claude/skills/wordpress-content-manager/scripts/wp-content.mjs posts delete-many \
  --status draft \
  --search "test" \
  --confirm

Advanced: Profile Files (Optional)

进阶:配置文件(可选)

For convenience, you can create profile files in
profiles/
to store site configurations. Environment variables always override profile values.
See
references/profiles.md
for the profile format.
Select a profile with
--profile <name>
or
WP_PROFILE=<name>
.
为方便使用,你可以在
profiles/
目录下创建配置文件来存储站点配置。环境变量始终会覆盖配置文件中的值。
配置文件格式请参考
references/profiles.md
可通过
--profile <name>
WP_PROFILE=<name>
选择配置文件。