Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

wordpress

БесплатноБез исполняемых скриптовНе проверен

Publish and manage posts on a self-hosted WordPress site via the WordPress REST API. Use when the user mentions WordPress, wp-admin, publishing / updating a…

AceDataCloudот AceDataCloud★ 17 звёзд на GitHub

Об этом скилле

Drive the WordPress REST API (/wp-json/wp/v2) with curl + jq.

The user's self-hosted WordPress credentials are injected as env vars:

  • $WORDPRESS_SITE_URL — site root, e.g. https://blog.example.com
  • $WORDPRESS_USERNAME — the WordPress login username
  • $WORDPRESS_APP_PASSWORD — an Application Password (WP 5.6+ core), NOT the login password. Treat it like a secret — never log or echo it.

Auth is HTTP Basic (username:app_password) over HTTPS. Set up a reusable base once, then every call reuses it:

# Normalize the site URL (strip a trailing slash) and build the API base.
SITE="${WORDPRESS_SITE_URL%/}"
API="$SITE/wp-json/wp/v2"
# -u sends HTTP Basic auth; --fail-with-body surfaces the JSON error body on 4xx/5xx.
WP=(curl -sS --fail-with-body -u "$WORDPRESS_USERNAME:$WORDPRESS_APP_PASSWORD")

Don't add -L/--location to these calls. A redirect usually means the site URL is wrong. curl strips the Authorization header when a redirect crosses host or scheme (e.g. http→https, apex→www) — exactly the cases that occur here — so the followed request runs unauthenticated and can return the site's HTML page with HTTP 200: it looks like success but wrote nothing. Fix the URL instead (see the /wp-json gotcha below).

Errors come back as {"code": "...", "message": "...", "data": {"status": 401}} — show message verbatim. Common codes:

HTTP Meaning What to tell the user
401 incorrect_password / bad Basic auth Application Password wrong or revoked → regenerate it and reconnect the WordPress connector
401 rest_not_logged_in on a plain-http:// site Application Passwords are disabled without HTTPS → the user must enable HTTPS
403 rest_cannot_create / insufficient role The user's role can't publish; needs Author/Editor/Admin, or Application Passwords are disabled on the site
404 rest_no_route REST API disabled or a security plugin blocks /wp-json → the user must re-enable it
400 rest_invalid_param Bad field (e.g. unknown category id) → fix and retry
500 rest_upload_sideload_error wp-content/uploads isn't writable by the web server → the user must fix directory permissions

content is HTML, not Markdown. Raw Markdown renders literally. pandoc is not installed — convert with Python's markdown package (preinstalled in the sandbox). If the import ever fails, pip install markdown first, then:

HTML=$(python3 -c "
import sys, markdown
print(markdown.markdown(sys.stdin.read(), extensions=['fenced_code','tables']))
" <<'MD'
## 标题

正文 **粗体**
MD
)

Step 0 — verify the connection first

"${WP[@]}" "$API/users/me?context=edit" | jq '{id, name, slug, roles}'

context=edit is required — without it WP omits roles/capabilities entirely, so you cannot tell whether the account may publish. A 200 with roles containing administrator, editor or author confirms the site URL, username, Application Password and publish permission. If this fails, stop and surface the error — don't attempt writes.

Publish or draft a post

Publishing is public and hard to undo — confirm with the user before using status=publish. Default to status=draft and hand back the edit link.

jq -n --arg t "国内如何稳定调用 Claude API" \
      --arg c "<p>正文 HTML……</p>" \
      --arg s "draft" \
  '{title:$t, content:$c, status:$s}' \
| "${WP[@]}" -X POST "$API/posts" \
    -H "Content-Type: application/json" -d @- \
| jq '{id, status, link, edit: "\(env.WORDPRESS_SITE_URL)/wp-admin/post.php?action=edit&post=\(.id)"}'

With categories / tags / excerpt (ids come from the endpoints below):

jq -n --arg t "标题" --arg c "<p>正文</p>" --arg e "一句话摘要" \
  '{title:$t, content:$c, excerpt:$e, status:"draft",
    categories:[5], tags:[12,34]}' \
| "${WP[@]}" -X POST "$API/posts" -H "Content-Type: application/json" -d @- \
| jq '{id, status, link}'
  • Publish an existing draft: POST $API/posts/<id> body {"status":"publish"}.
  • Update a post: POST $API/posts/<id> with any subset of fields (WP REST uses POST, not PUT, for updates).
  • Delete (trash) a post: "${WP[@]}" -X DELETE "$API/posts/<id>".
  • Schedule a post: {"status":"future","date_gmt":"2030-01-01T00:00:00"} (UTC, no trailing Z).

SEO fields that actually matter

WordPress core emits <link rel="canonical"> on its own but ships no meta description tag at all — that only appears if the site runs an SEO plugin (Yoast, Rank Math, SEOPress) or a theme that renders one. Those consume the post's excerpt, so setting excerpt is what makes a good description possible; it does nothing on a bare core install. For an SEO post always set:

Field Why
slug The permalink. Set it explicitly to a short ASCII keyword phrase — otherwise a CJK title becomes a percent-encoded URL.
excerpt Sourc
Полный SKILL.md на GitHub

Установить wordpress в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл wordpress?

Publish and manage posts on a self-hosted WordPress site via the WordPress REST API. Use when the user mentions WordPress, wp-admin, publishing / updating a blog post, managing categories or tags, or uploading media to their own WordPress site.

Как установить скилл wordpress?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл wordpress запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить wordpress с