← 返回 Skills 市场
55
总下载
1
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install wp-auto-post-api
功能描述
Publish SEO-optimized articles to WordPress via REST API with RankMath meta fields
使用说明 (SKILL.md)
WordPress SEO Publisher
通过 WordPress REST API 发布 SEO 优化文章,自动设置 RankMath Free 版 meta fields(SEO 标题、描述、焦点关键词)。
Requirements
python3(无需额外 pip 依赖,仅使用标准库)- WordPress 已安装 RankMath SEO Free
- WordPress 已创建 Application Password
- WordPress
functions.php中已注册 RankMath meta keys(见下方 WordPress 配置)
Directory Structure
scripts/
├── publish_wp_article.py # 主发布脚本
docs/
├── wordpress-setup.php # functions.php 代码片段(需手动添加到 WordPress)
Environment Variables
在 ~/.openclaw/workspace-marketing/.env 中配置:
WP_SITE_URL=https://你的域名
WP_USERNAME=WordPress用户名
WP_APP_PASSWORD=xxxx xxxx xxxx xxxx xxxx xxxx
WP_CATEGORY_ID=Articles分类的ID
执行方式
cd ~/.openclaw/workspace-marketing
export $(cat .env | grep "^WP_" | xargs)
python3 skills/wp-seo-publisher/scripts/publish_wp_article.py '\x3Cjson_data>'
JSON 参数定义
| 字段 | 类型 | 必填 | 说明 |
|---|---|---|---|
title |
String | ✅ | 文章标题(含关键词,50-60 字符) |
content |
String | ✅ | 文章 HTML 正文(使用 H2/H3 结构) |
excerpt |
String | 推荐 | 文章摘要,也用作默认 meta description |
slug |
String | 推荐 | SEO 友好的 URL(英文、连字符分隔) |
focus_keyword |
String | 推荐 | RankMath 焦点关键词 |
seo_title |
String | 否 | 自定义 SEO 标题(留空则用 title) |
seo_description |
String | 否 | 自定义 meta description(留空则用 excerpt) |
tags |
Array | 否 | 标签名称列表(不存在的 tag 会自动创建) |
category_id |
Number | 否 | 分类 ID(留空则用 .env 中的默认值) |
status |
String | 否 | publish 或 draft(默认 draft) |
RankMath 免费版自动处理的 SEO 功能
以下功能 RankMath 会根据文章内容自动处理,无需通过 API 额外设置:
| 功能 | 说明 |
|---|---|
| XML Sitemap | 新文章自动加入 sitemap,加速搜索引擎收录 |
| Canonical URL | 自动生成,防止重复内容问题 |
| Open Graph Tags | 自动生成 og:title、og:description、og:image |
| Twitter Cards | 自动生成社交分享卡片 |
| Article Schema | 自动添加 Article 结构化数据 |
| Meta Robots | 默认 index, follow |
| Breadcrumbs | 自动生成(需在 RankMath 设置中启用) |
通过 API 主动设置的字段(3 个)
| Meta Key | 对应 JSON 字段 | 作用 |
|---|---|---|
rank_math_title |
seo_title 或 title |
搜索结果中显示的标题 |
rank_math_description |
seo_description 或 excerpt |
搜索结果中显示的描述 |
rank_math_focus_keyword |
focus_keyword |
RankMath 内容评分的焦点关键词 |
AI Agent 发布工作流
注意:
- 关键词挖掘阶段已独立,必须委托给
seo-keyword-researcherSkill 处理。- 文章撰写与排版阶段已独立,必须委托给
seo-content-writerSkill 处理。本 Skill (
wp-seo-publisher) 仅负责「API 发布」与「日志记录」。
- 读取输入 (Input):前往目录
~/.openclaw/workspace-marketing/seo/seo_articles/,寻找并读取最新时间戳且尚未发布的 JSON 文件(例如2026-05-06_110000.json)。 - 人工确认 (Approval Gate):向用户展示即将发布的文章标题、slug 和 status,必须等待用户明确确认后才执行发布。如果用户未指定
status: "publish",默认以draft模式发布。 - 执行发布 (Execute):将该 JSON 文件的内容作为参数,传递给 Python 脚本:
python3 skills/wp-seo-publisher/scripts/publish_wp_article.py '\x3C读取到的 JSON 内容>' - 标记与记录 (Clean up):
- 防重复机制:发布成功后,必须将该 JSON 文件重命名,加上
_published后缀(例如执行mv 2026-05-06_110000.json 2026-05-06_110000_published.json)。 - 更新日志:将发布成功的结果与 URL 追加写入
memory/wp-articles-log.md。此日志仅用于本 Skill 的防重复检查和发布审计,不应被其他 Skill 用作数据输入源。
- 防重复机制:发布成功后,必须将该 JSON 文件重命名,加上
JSON 组装范例
{
"title": "Top 5 Benefits of Renting Robots for Corporate Events",
"content": "\x3Ch2>Why More Companies Are Choosing Robot Rental\x3C/h2>\x3Cp>In today's competitive event landscape...\x3C/p>\x3Ch2>1. Cost Efficiency\x3C/h2>\x3Cp>Purchasing a service robot can cost...\x3C/p>\x3Ch2>2. Professional Setup & Support\x3C/h2>\x3Cp>When you rent from a professional provider...\x3C/p>\x3Ch2>3. Cutting-Edge Technology\x3C/h2>\x3Cp>Robot technology evolves rapidly...\x3C/p>\x3Ch2>4. Wow Factor for Guests\x3C/h2>\x3Cp>Nothing captures attention quite like...\x3C/p>\x3Ch2>5. Flexibility and Variety\x3C/h2>\x3Cp>Different events call for different robots...\x3C/p>\x3Ch2>Ready to Elevate Your Next Event?\x3C/h2>\x3Cp>Contact us today for a free consultation and quote. \x3Ca href='https://example.com/contact'>Get in touch →\x3C/a>\x3C/p>",
"excerpt": "Discover the top 5 reasons why renting robots for corporate events saves money, impresses guests, and delivers cutting-edge experiences.",
"slug": "benefits-renting-robots-corporate-events",
"focus_keyword": "renting robots for corporate events",
"seo_title": "Top 5 Benefits of Renting Robots for Corporate Events | Your Company",
"seo_description": "Discover the top 5 reasons why renting robots for corporate events saves money, impresses guests, and delivers cutting-edge experiences.",
"tags": ["robot rental", "corporate events", "service robots", "event technology"],
"status": "draft"
}
发布记录格式(memory/wp-articles-log.md)
## 2026-05-07
- **Title**: Top 5 Benefits of Renting Robots for Corporate Events
- **URL**: https://example.com/benefits-renting-robots-corporate-events/
- **Focus Keyword**: renting robots for corporate events
- **Tags**: robot rental, corporate events, service robots, event technology
- **Status**: published
主题库(Agent 轮换使用)
- Robot rental benefits for businesses
- Industry applications: hospitality
- Industry applications: retail
- Industry applications: events & exhibitions
- Industry applications: healthcare
- Industry applications: education
- Event planning with service robots
- Robot technology trends and innovations
- FAQ: robot rental process, pricing, setup
- Cost analysis: buying vs renting robots
- Customer engagement with robots
- Future of service robotics in Hong Kong
- How to choose the right robot for your event
- Robot safety and insurance considerations
- Success stories: robots at corporate events
WordPress 配置(一次性设置)
必要步骤
- 安装 RankMath Free → Plugins → Add New → 搜索 Rank Math SEO
- 创建 Application Password → Users → Profile → Application Passwords
- 注册 meta keys → 将
docs/wordpress-setup.php中的代码添加到主题functions.php - 记录分类 ID → Posts → Categories → 找到 Articles 的 ID
返回值
成功时输出:
✅ Article published successfully!
Post ID: 123
URL: https://example.com/your-article-slug/
Status: publish
Focus Keyword: your keyword
__RESULT_JSON__:{"success":true,"post_id":123,"url":"...","status":"publish",...}
失败时返回非零退出码,并输出错误信息。
注意事项
- 首次使用建议用
status: "draft"测试,在 WordPress 后台确认 RankMath 数据正确 - 确保 WordPress 启用 HTTPS,否则 Application Password 不安全
- 文章内容必须有实质价值,不要生成低质量 SEO spam
- 每篇文章的 slug 必须唯一,避免冲突
- focus_keyword 应与文章主题一致,这会影响 RankMath 的内容评分
安全使用建议
Install only if you want an agent to create WordPress posts through the REST API. Configure a dedicated low-privilege WordPress user, use HTTPS, keep the application password out of chat/logs, test with draft status first, and review the full article before approving any published post.
功能分析
Type: OpenClaw Skill
Name: wp-auto-post-api
Version: 2.1.1
The skill is a legitimate tool for publishing SEO-optimized articles to WordPress via the REST API. It uses standard Python libraries (urllib) for network requests and follows WordPress security practices by utilizing Application Passwords and enforcing capability checks (edit_posts) in the provided PHP configuration snippet. The AI instructions in SKILL.md include a mandatory 'Approval Gate' requiring user confirmation before publishing, and the script (publish_wp_article.py) contains no evidence of data exfiltration, obfuscation, or unauthorized execution.
能力评估
Purpose & Capability
The artifacts coherently match the stated purpose: they publish posts to WordPress, create or resolve tags, and set RankMath SEO metadata. This is expected, but it is still a high-impact content-publishing capability.
Instruction Scope
The workflow includes an explicit approval gate and defaults to draft status, which reduces risk. Users should still review the full article content, links, tags, and status before approving publication.
Install Mechanism
There is no package install step and the Python script uses only the standard library. Setup does include a manual WordPress PHP snippet that persists in the site theme or snippets plugin.
Credentials
The skill requires WordPress site URL, username, and application password in environment variables, which is proportionate to REST API publishing. Registry metadata does not surface these env vars or credentials, so users should configure them carefully.
Persistence & Privilege
The skill writes a publishing log and renames processed article JSON files for duplicate prevention. The WordPress setup snippet also persists until manually removed.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install wp-auto-post-api - 安装完成后,直接呼叫该 Skill 的名称或使用
/wp-auto-post-api触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.1.1
**Adds user approval step and draft-by-default publishing.**
- Now requires explicit user confirmation before publishing each article.
- 严格要求每次发布文章时请求用户同意
- Default article status changed from "publish" to "draft" if not specified.
- 默认的发布文章状态从原来的‘发布’改为‘草稿’
- Updated documentation to clarify the user approval step and draft default.
- 更新文档以说明用户的同意流程以及草稿为默认状态
- Added environment variable and credential definitions to SKILL.md frontmatter.
- Improved guidance on logging: the publication log is for internal audit only, not for cross-skill data input.
v2.1.0
**Skill upgraded to focus on SEO publishing with RankMath meta fields.**
**Skill 升级以深度集成RankMath插件的Meta数据**
- Now publishes WordPress articles with RankMath meta fields (SEO title, description, focus keyword) via REST API.
- 通过REST API的方式, 使用RankMath插件进行WordPress文章的发送, meta数据已支持
- New markdown documentation covers requirements, directory structure, JSON API parameters, workflow, and best practices.
- 现在的.md文档覆盖了依赖, 目录结构, JSON API参数, 工作流和最佳实践
- Details provided for environment setup, JSON input definition, post-publish logging, and integration with other skills.
- 细化了对于.env文件的指南, JSON的输入规范, 发布日志和对其他前置任务(例如seo文章等)的集成
- Emphasizes that keyword research and content writing are handled by separate skills; this skill specializes in publishing and logging.
- SEO关键词搜索和SEO文章撰写已不在此skill中, 留给用户自行发挥(网上的资源更加详细)
- Improved workflow for de-duplication, post status management, and log updates.
元数据
常见问题
WordPress API Auto Post 文章自动发布API 是什么?
Publish SEO-optimized articles to WordPress via REST API with RankMath meta fields. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 55 次。
如何安装 WordPress API Auto Post 文章自动发布API?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install wp-auto-post-api」即可一键安装,无需额外配置。
WordPress API Auto Post 文章自动发布API 是免费的吗?
是的,WordPress API Auto Post 文章自动发布API 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
WordPress API Auto Post 文章自动发布API 支持哪些平台?
WordPress API Auto Post 文章自动发布API 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 WordPress API Auto Post 文章自动发布API?
由 L1angjy(@l1angjy)开发并维护,当前版本 v2.1.1。
推荐 Skills