wp-wpcli-and-ops

โดย wordpress

การดำเนินการและระบบอัตโนมัติของ WordPress ผ่าน WP-CLI พร้อมการค้นหาและแทนที่อย่างปลอดภัย การจัดการฐานข้อมูล และรองรับ multisite ครอบคลุมการค้นหาและแทนที่สำหรับการย้ายโดเมน การส่งออก/นำเข้าฐานข้อมูล การจัดการปลั๊กอิน/ธีม/ผู้ใช้ การตรวจสอบ cron และการล้างแคช มีระบบป้องกันในตัว: การยืนยันสภาพแวดล้อม การตรวจสอบแบบ dry-run และขั้นตอนการสำรองข้อมูลก่อนการดำเนินการที่อาจก่อให้เกิดความเสียหาย รองรับการทำงานแบบ multisite ด้วยการกำหนดเป้าหมายเฉพาะไซต์ ( --url ) และทั้งเครือข่าย ( --network ) ช่วยให้...

npx skills add https://github.com/wordpress/agent-skills --skill wp-wpcli-and-ops

WP-CLI and Ops

When to use

Use this skill when the task involves WordPress operational work via WP-CLI, including:

  • wp search-replace (URL changes, domain migrations, protocol switch)
  • DB export/import, resets, and inspections (wp db *)
  • plugin/theme install/activate/update, language packs
  • cron event listing/running
  • cache/rewrite flushing
  • multisite operations (wp site *, --url, --network)
  • building repeatable scripts (wp-cli.yml, shell scripts, CI jobs)

Inputs required

  • Where WP-CLI will run (local dev, staging, production) and whether it’s safe to run.
  • How to target the correct site root:
    • --path=<wordpress-root> and (multisite) --url=<site-url>
  • Whether this is multisite and whether commands should run network-wide.
  • Any constraints (no downtime, no DB writes, maintenance window).

Procedure

0) Guardrails: confirm environment and blast radius

WP-CLI commands can be destructive. Before running anything that writes:

  1. Confirm environment (dev/staging/prod).
  2. Confirm targeting (path/url) so you don’t hit the wrong site.
  3. Make a backup when performing risky operations.

Read:

  • references/safety.md

1) Inspect WP-CLI and site targeting (deterministic)

Run the inspector:

  • node skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs --path=<path> [--url=<url>]

If WP-CLI isn’t available, fall back to installing it via the project’s documented tooling (Composer, container, or system package), or ask for the expected execution environment.

2) Choose the right workflow

A) Safe URL/domain migration (search-replace)

Follow a safe sequence:

  1. wp db export (backup)
  2. wp search-replace --dry-run (review impact)
  3. Run the real replace with appropriate flags
  4. Flush caches/rewrite if needed

Read:

  • references/search-replace.md

B) Plugin/theme operations

Use wp plugin * / wp theme * and confirm you’re acting on the intended site (and network) first.

Read:

  • references/packages-and-updates.md

C) Cron and queues

Inspect cron state and run individual events for debugging rather than “run everything blindly”.

Read:

  • references/cron-and-cache.md

D) Multisite operations

Multisite changes can affect many sites. Always decide whether you’re operating:

  • on a single site (--url=), or
  • network-wide (--network / iterating sites)

Read:

  • references/multisite.md

3) Automation patterns (scripts + wp-cli.yml)

For repeatable ops, prefer:

  • wp-cli.yml for defaults (path/url, PHP memory limits)
  • shell scripts that log commands and stop on error
  • CI jobs that run read-only checks by default

Read:

  • references/automation.md

Verification

  • Re-run wpcli_inspect after changes that could affect targeting or config.
  • Confirm intended side effects:
    • correct URLs updated
    • plugins/themes in expected state
    • cron/caches flushed where needed
  • If there’s a health check endpoint or smoke test suite, run it after ops changes.

Failure modes / debugging

  • “Error: This does not seem to be a WordPress installation.”
    • wrong --path, wrong container, or missing wp-config.php
  • Multisite commands affecting the wrong site
    • missing --url or wrong URL
  • Search-replace causes unexpected serialization issues
    • wrong flags or changing serialized data unsafely

See:

  • references/debugging.md

Escalation

  • If you cannot confirm environment safety, do not run write operations.
  • If the repo uses containerized tooling (Docker/wp-env) but you can’t access it, ask for the intended command runner or CI job.

Skills เพิ่มเติมจาก wordpress

blueprint
wordpress
ใช้เมื่อสร้าง แก้ไข หรือตรวจสอบไฟล์ JSON blueprint ของ WordPress Playground ทำงานเมื่อมีการกล่าวถึง blueprints, การกำหนดค่า playground หรือคำขอ…
official
wordpress-router
wordpress
จัดประเภทโค้ดเบส WordPress และกำหนดเส้นทางไปยังเวิร์กโฟลว์ที่ถูกต้องสำหรับปลั๊กอิน ธีม บล็อก และการเช็คเอาต์แกนกลาง ดำเนินการคัดแยกโปรเจกต์อัตโนมัติเพื่อระบุประเภทของรีโพสิทอรี (ปลั๊กอิน ธีม ธีมบล็อก บล็อก Gutenberg แกนกลาง WP) และเครื่องมือที่มีอยู่ ส่งออกผลลัพธ์การจัดประเภทและการตัดสินใจเส้นทางไปยังสกิลเฉพาะโดเมนตามความตั้งใจของผู้ใช้และประเภทของโปรเจกต์ ต้องการสิทธิ์เข้าถึงรากของรีโพสิทอรีและการดำเนินการระบบไฟล์ bash/Node บางเวิร์กโฟลว์ต้องใช้ WP-CLI กำหนดเป้าหมาย WordPress 6.9+ พร้อม PHP 7.2.24+;...
official
wp-abilities-api
wordpress
การลงทะเบียน WordPress Abilities API, การเปิดเผยผ่าน REST, และการใช้งานฝั่งไคลเอ็นต์สำหรับ WordPress 6.9 ขึ้นไป ลงทะเบียนความสามารถและหมวดหมู่ใน PHP โดยใช้ wp_register_ability() และ wp_register_ability_category() พร้อม ID, ป้ายกำกับ, และข้อมูลเมตาที่เสถียร เปิดเผยความสามารถให้กับไคลเอ็นต์ผ่าน REST endpoints /wp-json/wp-abilities/v1/ โดยตั้งค่า meta.show_in_rest: true ใช้งานความสามารถใน JavaScript โดยใช้แพ็คเกจ @wordpress/abilities สำหรับการเข้าถึงฝั่งไคลเอ็นต์และการตรวจสอบสิทธิ์ ต้องใช้ WordPress 6.9 ขึ้นไป...
official
wp-abilities-audit
wordpress
ตรวจสอบส่วนติดต่อ REST ของปลั๊กอิน WordPress และสร้างเอกสารการตรวจสอบมาตรฐานที่เสนอการลงทะเบียน Abilities API สร้างเอกสาร markdown พร้อม YAML…
official
wp-abilities-verify
wordpress
ตรวจสอบการลงทะเบียน Abilities API ของปลั๊กอิน WordPress: แจกแจงความสามารถ ตรวจสอบว่าพฤติกรรมของ callback ตรงกับข้อความอ้างอิงของแต่ละคำอธิบายประกอบ (การโจมตีแบบ adversarial…)
official
wp-block-development
wordpress
การพัฒนา WordPress block สำหรับ Gutenberg: metadata, การลงทะเบียน, การเรนเดอร์ และขั้นตอนการสร้าง ครอบคลุมการสร้าง block, การกำหนดค่า block.json, การเรนเดอร์แบบ static vs dynamic และการลงทะเบียน PHP ฝั่งเซิร์ฟเวอร์ด้วย register_block_type_from_metadata() บังคับใช้ apiVersion: 3 เพื่อความเข้ากันได้กับ WordPress 6.9+ รวมถึงการรองรับ iframe editor และการแยกสไตล์ จัดการการจัดลำดับ attribute, deprecations/migrations เพื่อป้องกันข้อผิดพลาด "Invalid block" และการประกอบ inner blocks รวมถึง...
official
wp-block-themes
wordpress
การพัฒนา WordPress block theme: theme.json, templates, patterns, และการแก้ไขปัญหา Site Editor ครอบคลุมการแก้ไข theme.json (presets, settings, per-block styles), templates และ template parts, patterns, และ style variations ใน WordPress 6.9+ รวมถึงสคริปต์ triage เพื่อตรวจจับ theme roots และโครงสร้าง block theme พร้อมขั้นตอนแนะนำสำหรับการสร้างธีมใหม่หรือแปลงธีมแบบคลาสสิก ให้เวิร์กโฟลว์การดีบักสำหรับปัญหาเกี่ยวกับลำดับชั้นของสไตล์ การแทนที่การปรับแต่งของผู้ใช้ และ Site...
official
wp-interactivity-api
wordpress
ใช้เมื่อสร้างหรือดีบักฟีเจอร์ของ WordPress Interactivity API (data-wp-* directives, @wordpress/interactivity store/state/actions, block viewScriptModule…)
official