wordpress-content by jezweb/claude-skills
npx skills add https://github.com/jezweb/claude-skills --skill wordpress-content创建、更新和管理 WordPress 内容——包括文章、页面、媒体、分类目录、标签和菜单。通过 WP-CLI 或 REST API 在网站上生成实时内容。
wordpress.config.json 或 wp-cli.yml 的站点配置| 任务 | 最佳方法 |
|---|---|
| 创建/编辑单篇文章或页面 | WP-CLI wp post create/update |
| 批量创建文章 | WP-CLI 循环或 REST API 批量操作 |
| 上传图片/媒体 | WP-CLI wp media import |
| 管理分类目录/标签 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
WP-CLI wp term |
| 更新导航菜单 | WP-CLI wp menu |
| 定时发布文章 | 使用 --post_date 参数的 WP-CLI |
| 复杂的 HTML 内容 | 写入临时文件,然后传递给 WP-CLI |
# 简单文章
wp @site post create \
--post_type=post \
--post_title="My New Blog Post" \
--post_content="<p>Post content here.</p>" \
--post_status=draft \
--post_category=3,5
# 从 HTML 文件创建文章(适用于长内容)
wp @site post create ./post-content.html \
--post_type=post \
--post_title="My New Blog Post" \
--post_status=draft \
--post_excerpt="A brief summary of the post." \
--post_category=3,5 \
--tags_input="tag1,tag2"
文章状态:draft、publish、pending、future(与 --post_date 一起使用)
wp @site post create \
--post_type=page \
--post_title="About Us" \
--post_content="<h2>Our Story</h2><p>Content here...</p>" \
--post_status=publish \
--post_parent=0 \
--menu_order=10
wp @site post create \
--post_type=post \
--post_title="Scheduled Post" \
--post_content="<p>This goes live tomorrow.</p>" \
--post_status=future \
--post_date="2026-02-23 09:00:00"
# 从 URL 上传
wp @site media import "https://example.com/image.jpg" \
--title="Product Photo" \
--alt="Product front view" \
--caption="Our latest product"
# 从本地文件上传(对于远程站点需要先进行 SCP 传输)
scp ./image.jpg user@host:/tmp/image.jpg
wp @site media import /tmp/image.jpg --title="Local Upload"
为文章设置特色图片:
# 从导入输出中获取附件 ID,然后:
wp @site post meta update {post_id} _thumbnail_id {attachment_id}
# 列出分类目录
wp @site term list category --fields=term_id,name,slug,count
# 创建分类目录
wp @site term create category "News" --slug=news --description="Company news and updates"
# 创建子分类目录
wp @site term create category "Product News" --slug=product-news --parent=5
# 为文章分配分类目录
wp @site post term add {post_id} category news
# 在创建文章时添加标签
wp @site post create --post_title="..." --tags_input="seo,marketing,tips"
# 为现有文章添加标签
wp @site post term add {post_id} post_tag seo marketing tips
# 列出菜单
wp @site menu list --fields=term_id,name,slug,count
# 列出菜单中的项目
wp @site menu item list main-menu --fields=db_id,type,title,link
# 将页面添加到菜单
wp @site menu item add-post main-menu {page_id} --title="About Us"
# 添加自定义链接
wp @site menu item add-custom main-menu "Contact" "https://example.com/contact/"
# 重新排序(设置位置)
wp @site menu item update {item_id} --position=3
# 更新文章标题和内容
wp @site post update {post_id} \
--post_title="Updated Title" \
--post_content="<p>New content.</p>"
# 从文件更新
wp @site post update {post_id} ./updated-content.html
# 批量更新状态
wp @site post list --post_type=post --post_status=draft --field=ID | \
xargs -I {} wp @site post update {} --post_status=publish
# 检查文章
wp @site post get {post_id} --fields=ID,post_title,post_status,guid
# 获取实时 URL
wp @site post get {post_id} --field=guid
# 列出最近的文章
wp @site post list --post_type=post --posts_per_page=5 --fields=ID,post_title,post_status,post_date
提供管理后台 URL 和实时 URL:
https://example.com/wp-admin/post.php?post={id}&action=edithttps://example.com/{slug}/对于超过一句话的内容,请将 HTML 写入临时文件并传递:
cat > /tmp/post-content.html << 'EOF'
<h2>Section Heading</h2>
<p>Paragraph content with <strong>bold</strong> and <a href="/link">links</a>.</p>
<ul>
<li>List item one</li>
<li>List item two</li>
</ul>
EOF
wp @site post create /tmp/post-content.html --post_title="My Post" --post_status=draft
在 --post_content 中使用 Shell 引号处理复杂 HTML 时容易出错。
要创建多篇文章,请使用带验证的循环:
while IFS=, read -r title slug content_file category; do
wp @site post create "$content_file" \
--post_type=post \
--post_title="$title" \
--post_name="$slug" \
--post_category="$category" \
--post_status=draft
sleep 0.5
done < posts.csv
始终先创建为 draft,审核后再批量发布。
如果安装了 Advanced Custom Fields:
# 设置 ACF 字段
wp @site post meta update {post_id} field_name "value"
# 获取 ACF 字段
wp @site post meta get {post_id} field_name
ACF 同时存储字段值和引用键(_field_name → field_abc123)。
当 WP-CLI 不可用时,请使用 REST API。有关模式,请参阅 references/rest-api-endpoints.md。
references/rest-api-endpoints.md — 包含身份验证示例的 REST API 端点references/wp-cli-content.md — WP-CLI 内容管理命令参考每周安装数
352
代码仓库
GitHub 星标数
643
首次出现
2026年2月22日
安全审计
安装于
codex321
gemini-cli320
opencode320
github-copilot319
kimi-cli318
amp318
Create, update, and manage WordPress content — posts, pages, media, categories, tags, and menus. Produces live content on the site via WP-CLI or the REST API.
wordpress.config.json or wp-cli.yml| Task | Best Method |
|---|---|
| Create/edit single post or page | WP-CLI wp post create/update |
| Bulk create posts | WP-CLI loop or REST API batch |
| Upload images/media | WP-CLI wp media import |
| Manage categories/tags | WP-CLI wp term |
| Update navigation menus | WP-CLI wp menu |
| Scheduled posts | WP-CLI with --post_date |
| Complex HTML content | Write to temp file, pass to WP-CLI |
# Simple post
wp @site post create \
--post_type=post \
--post_title="My New Blog Post" \
--post_content="<p>Post content here.</p>" \
--post_status=draft \
--post_category=3,5
# Post from HTML file (better for long content)
wp @site post create ./post-content.html \
--post_type=post \
--post_title="My New Blog Post" \
--post_status=draft \
--post_excerpt="A brief summary of the post." \
--post_category=3,5 \
--tags_input="tag1,tag2"
Post statuses : draft, publish, pending, future (use with --post_date)
wp @site post create \
--post_type=page \
--post_title="About Us" \
--post_content="<h2>Our Story</h2><p>Content here...</p>" \
--post_status=publish \
--post_parent=0 \
--menu_order=10
wp @site post create \
--post_type=post \
--post_title="Scheduled Post" \
--post_content="<p>This goes live tomorrow.</p>" \
--post_status=future \
--post_date="2026-02-23 09:00:00"
# Upload from URL
wp @site media import "https://example.com/image.jpg" \
--title="Product Photo" \
--alt="Product front view" \
--caption="Our latest product"
# Upload from local file (requires SCP first for remote sites)
scp ./image.jpg user@host:/tmp/image.jpg
wp @site media import /tmp/image.jpg --title="Local Upload"
Set featured image on a post :
# Get the attachment ID from the import output, then:
wp @site post meta update {post_id} _thumbnail_id {attachment_id}
# List categories
wp @site term list category --fields=term_id,name,slug,count
# Create category
wp @site term create category "News" --slug=news --description="Company news and updates"
# Create child category
wp @site term create category "Product News" --slug=product-news --parent=5
# Assign category to post
wp @site post term add {post_id} category news
# Add tags during post creation
wp @site post create --post_title="..." --tags_input="seo,marketing,tips"
# Add tags to existing post
wp @site post term add {post_id} post_tag seo marketing tips
# List menus
wp @site menu list --fields=term_id,name,slug,count
# List items in a menu
wp @site menu item list main-menu --fields=db_id,type,title,link
# Add page to menu
wp @site menu item add-post main-menu {page_id} --title="About Us"
# Add custom link
wp @site menu item add-custom main-menu "Contact" "https://example.com/contact/"
# Reorder (set position)
wp @site menu item update {item_id} --position=3
# Update post title and content
wp @site post update {post_id} \
--post_title="Updated Title" \
--post_content="<p>New content.</p>"
# Update from file
wp @site post update {post_id} ./updated-content.html
# Bulk update status
wp @site post list --post_type=post --post_status=draft --field=ID | \
xargs -I {} wp @site post update {} --post_status=publish
# Check the post
wp @site post get {post_id} --fields=ID,post_title,post_status,guid
# Get the live URL
wp @site post get {post_id} --field=guid
# List recent posts
wp @site post list --post_type=post --posts_per_page=5 --fields=ID,post_title,post_status,post_date
Provide the admin URL and live URL:
https://example.com/wp-admin/post.php?post={id}&action=edithttps://example.com/{slug}/For anything beyond a sentence, write HTML to a temp file and pass it:
cat > /tmp/post-content.html << 'EOF'
<h2>Section Heading</h2>
<p>Paragraph content with <strong>bold</strong> and <a href="/link">links</a>.</p>
<ul>
<li>List item one</li>
<li>List item two</li>
</ul>
EOF
wp @site post create /tmp/post-content.html --post_title="My Post" --post_status=draft
Shell quoting in --post_content is fragile for complex HTML.
For creating many posts, use a loop with verification:
while IFS=, read -r title slug content_file category; do
wp @site post create "$content_file" \
--post_type=post \
--post_title="$title" \
--post_name="$slug" \
--post_category="$category" \
--post_status=draft
sleep 0.5
done < posts.csv
Always create as draft first, review, then bulk-publish.
If Advanced Custom Fields is installed:
# Set ACF field
wp @site post meta update {post_id} field_name "value"
# Get ACF field
wp @site post meta get {post_id} field_name
ACF stores fields with both the field value and a reference key (_field_name → field_abc123).
When WP-CLI isn't available, use the REST API. See references/rest-api-endpoints.md for patterns.
references/rest-api-endpoints.md — REST API endpoints with authentication examplesreferences/wp-cli-content.md — WP-CLI content management command referenceWeekly Installs
352
Repository
GitHub Stars
643
First Seen
Feb 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex321
gemini-cli320
opencode320
github-copilot319
kimi-cli318
amp318
xdrop 文件传输脚本:Bun 环境下安全上传下载工具,支持加密分享
20,700 周安装