claude-plugin-wordpress-manager 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (142) hide show
  1. package/.claude-plugin/plugin.json +19 -0
  2. package/.mcp.json +19 -0
  3. package/CHANGELOG.md +62 -0
  4. package/LICENSE +69 -0
  5. package/README.md +213 -0
  6. package/agents/wp-content-strategist.md +148 -0
  7. package/agents/wp-deployment-engineer.md +93 -0
  8. package/agents/wp-performance-optimizer.md +198 -0
  9. package/agents/wp-security-auditor.md +161 -0
  10. package/agents/wp-site-manager.md +109 -0
  11. package/commands/wp-audit.md +37 -0
  12. package/commands/wp-backup.md +45 -0
  13. package/commands/wp-deploy.md +38 -0
  14. package/commands/wp-setup.md +64 -0
  15. package/commands/wp-status.md +53 -0
  16. package/docs/GUIDE.md +1190 -0
  17. package/hooks/hooks.json +57 -0
  18. package/hooks/scripts/backup-reminder.sh +29 -0
  19. package/hooks/scripts/pre-deploy-check.sh +49 -0
  20. package/package.json +46 -0
  21. package/scripts/health-check.sh +110 -0
  22. package/scripts/validate-wp-operation.sh +115 -0
  23. package/servers/wp-rest-bridge/build/server.d.ts +2 -0
  24. package/servers/wp-rest-bridge/build/server.js +74 -0
  25. package/servers/wp-rest-bridge/build/tools/comments.d.ts +227 -0
  26. package/servers/wp-rest-bridge/build/tools/comments.js +192 -0
  27. package/servers/wp-rest-bridge/build/tools/index.d.ts +919 -0
  28. package/servers/wp-rest-bridge/build/tools/index.js +30 -0
  29. package/servers/wp-rest-bridge/build/tools/media.d.ts +174 -0
  30. package/servers/wp-rest-bridge/build/tools/media.js +247 -0
  31. package/servers/wp-rest-bridge/build/tools/plugin-repository.d.ts +62 -0
  32. package/servers/wp-rest-bridge/build/tools/plugin-repository.js +149 -0
  33. package/servers/wp-rest-bridge/build/tools/plugins.d.ts +153 -0
  34. package/servers/wp-rest-bridge/build/tools/plugins.js +175 -0
  35. package/servers/wp-rest-bridge/build/tools/search.d.ts +44 -0
  36. package/servers/wp-rest-bridge/build/tools/search.js +44 -0
  37. package/servers/wp-rest-bridge/build/tools/unified-content.d.ts +328 -0
  38. package/servers/wp-rest-bridge/build/tools/unified-content.js +628 -0
  39. package/servers/wp-rest-bridge/build/tools/unified-taxonomies.d.ts +244 -0
  40. package/servers/wp-rest-bridge/build/tools/unified-taxonomies.js +492 -0
  41. package/servers/wp-rest-bridge/build/tools/users.d.ts +269 -0
  42. package/servers/wp-rest-bridge/build/tools/users.js +226 -0
  43. package/servers/wp-rest-bridge/build/types.d.ts +151 -0
  44. package/servers/wp-rest-bridge/build/types.js +2 -0
  45. package/servers/wp-rest-bridge/build/wordpress.d.ts +48 -0
  46. package/servers/wp-rest-bridge/build/wordpress.js +305 -0
  47. package/servers/wp-rest-bridge/package.json +27 -0
  48. package/skills/wordpress-router/SKILL.md +78 -0
  49. package/skills/wordpress-router/references/decision-tree.md +88 -0
  50. package/skills/wp-abilities-api/SKILL.md +97 -0
  51. package/skills/wp-abilities-api/references/php-registration.md +67 -0
  52. package/skills/wp-abilities-api/references/rest-api.md +13 -0
  53. package/skills/wp-audit/SKILL.md +114 -0
  54. package/skills/wp-audit/references/performance-checklist.md +113 -0
  55. package/skills/wp-audit/references/security-checklist.md +95 -0
  56. package/skills/wp-audit/references/seo-checklist.md +128 -0
  57. package/skills/wp-backup/SKILL.md +87 -0
  58. package/skills/wp-backup/references/backup-strategies.md +116 -0
  59. package/skills/wp-backup/references/restore-procedures.md +129 -0
  60. package/skills/wp-block-development/SKILL.md +176 -0
  61. package/skills/wp-block-development/references/attributes-and-serialization.md +22 -0
  62. package/skills/wp-block-development/references/block-json.md +49 -0
  63. package/skills/wp-block-development/references/creating-new-blocks.md +46 -0
  64. package/skills/wp-block-development/references/debugging.md +36 -0
  65. package/skills/wp-block-development/references/deprecations.md +24 -0
  66. package/skills/wp-block-development/references/dynamic-rendering.md +23 -0
  67. package/skills/wp-block-development/references/inner-blocks.md +25 -0
  68. package/skills/wp-block-development/references/registration.md +30 -0
  69. package/skills/wp-block-development/references/supports-and-wrappers.md +18 -0
  70. package/skills/wp-block-development/references/tooling-and-testing.md +21 -0
  71. package/skills/wp-block-development/scripts/list_blocks.mjs +121 -0
  72. package/skills/wp-block-themes/SKILL.md +118 -0
  73. package/skills/wp-block-themes/references/creating-new-block-theme.md +37 -0
  74. package/skills/wp-block-themes/references/debugging.md +24 -0
  75. package/skills/wp-block-themes/references/patterns.md +18 -0
  76. package/skills/wp-block-themes/references/style-variations.md +14 -0
  77. package/skills/wp-block-themes/references/templates-and-parts.md +16 -0
  78. package/skills/wp-block-themes/references/theme-json.md +59 -0
  79. package/skills/wp-block-themes/scripts/detect_block_themes.mjs +117 -0
  80. package/skills/wp-content/SKILL.md +103 -0
  81. package/skills/wp-content/references/content-templates.md +230 -0
  82. package/skills/wp-content/references/seo-optimization.md +169 -0
  83. package/skills/wp-deploy/SKILL.md +52 -0
  84. package/skills/wp-deploy/references/hostinger-deploy.md +51 -0
  85. package/skills/wp-deploy/references/ssh-deploy.md +63 -0
  86. package/skills/wp-interactivity-api/SKILL.md +181 -0
  87. package/skills/wp-interactivity-api/references/debugging.md +29 -0
  88. package/skills/wp-interactivity-api/references/directives-quickref.md +30 -0
  89. package/skills/wp-interactivity-api/references/server-side-rendering.md +310 -0
  90. package/skills/wp-migrate/SKILL.md +100 -0
  91. package/skills/wp-migrate/references/cross-platform.md +104 -0
  92. package/skills/wp-migrate/references/hostinger-migration.md +86 -0
  93. package/skills/wp-performance/SKILL.md +148 -0
  94. package/skills/wp-performance/references/autoload-options.md +24 -0
  95. package/skills/wp-performance/references/cron.md +20 -0
  96. package/skills/wp-performance/references/database.md +20 -0
  97. package/skills/wp-performance/references/http-api.md +15 -0
  98. package/skills/wp-performance/references/measurement.md +21 -0
  99. package/skills/wp-performance/references/object-cache.md +24 -0
  100. package/skills/wp-performance/references/query-monitor-headless.md +38 -0
  101. package/skills/wp-performance/references/server-timing.md +22 -0
  102. package/skills/wp-performance/references/wp-cli-doctor.md +24 -0
  103. package/skills/wp-performance/references/wp-cli-profile.md +32 -0
  104. package/skills/wp-performance/scripts/perf_inspect.mjs +128 -0
  105. package/skills/wp-phpstan/SKILL.md +99 -0
  106. package/skills/wp-phpstan/references/configuration.md +52 -0
  107. package/skills/wp-phpstan/references/third-party-classes.md +76 -0
  108. package/skills/wp-phpstan/references/wordpress-annotations.md +124 -0
  109. package/skills/wp-phpstan/scripts/phpstan_inspect.mjs +263 -0
  110. package/skills/wp-playground/SKILL.md +103 -0
  111. package/skills/wp-playground/references/blueprints.md +36 -0
  112. package/skills/wp-playground/references/cli-commands.md +39 -0
  113. package/skills/wp-playground/references/debugging.md +16 -0
  114. package/skills/wp-plugin-development/SKILL.md +114 -0
  115. package/skills/wp-plugin-development/references/data-and-cron.md +19 -0
  116. package/skills/wp-plugin-development/references/debugging.md +19 -0
  117. package/skills/wp-plugin-development/references/lifecycle.md +33 -0
  118. package/skills/wp-plugin-development/references/security.md +29 -0
  119. package/skills/wp-plugin-development/references/settings-api.md +22 -0
  120. package/skills/wp-plugin-development/references/structure.md +16 -0
  121. package/skills/wp-plugin-development/scripts/detect_plugins.mjs +122 -0
  122. package/skills/wp-project-triage/SKILL.md +40 -0
  123. package/skills/wp-project-triage/references/triage.schema.json +143 -0
  124. package/skills/wp-project-triage/scripts/detect_wp_project.mjs +592 -0
  125. package/skills/wp-rest-api/SKILL.md +116 -0
  126. package/skills/wp-rest-api/references/authentication.md +18 -0
  127. package/skills/wp-rest-api/references/custom-content-types.md +20 -0
  128. package/skills/wp-rest-api/references/discovery-and-params.md +20 -0
  129. package/skills/wp-rest-api/references/responses-and-fields.md +30 -0
  130. package/skills/wp-rest-api/references/routes-and-endpoints.md +36 -0
  131. package/skills/wp-rest-api/references/schema.md +22 -0
  132. package/skills/wp-wpcli-and-ops/SKILL.md +125 -0
  133. package/skills/wp-wpcli-and-ops/references/automation.md +30 -0
  134. package/skills/wp-wpcli-and-ops/references/cron-and-cache.md +23 -0
  135. package/skills/wp-wpcli-and-ops/references/debugging.md +17 -0
  136. package/skills/wp-wpcli-and-ops/references/multisite.md +22 -0
  137. package/skills/wp-wpcli-and-ops/references/packages-and-updates.md +22 -0
  138. package/skills/wp-wpcli-and-ops/references/safety.md +30 -0
  139. package/skills/wp-wpcli-and-ops/references/search-replace.md +40 -0
  140. package/skills/wp-wpcli-and-ops/scripts/wpcli_inspect.mjs +90 -0
  141. package/skills/wpds/SKILL.md +60 -0
  142. package/skills/wpds/references/wpds-mcp-setup.md +59 -0
@@ -0,0 +1,104 @@
1
+ # Cross-Platform Migration Strategies
2
+
3
+ ## WordPress.com → Self-Hosted WordPress
4
+
5
+ ### Method 1: WXR Export (Content Only)
6
+ 1. WordPress.com Admin → Tools → Export → All content
7
+ 2. Download the .xml file (WXR format)
8
+ 3. On destination: Tools → Import → WordPress Importer
9
+ 4. Upload the WXR file
10
+ 5. Map authors and import attachments
11
+
12
+ **Limitations**: Doesn't transfer themes, plugins, or custom settings
13
+
14
+ ### Method 2: WordPress.com MCP (if available)
15
+ 1. Use WordPress.com MCP to read content
16
+ 2. Use WP REST Bridge to write content to destination
17
+ 3. Advantage: More control over content transformation
18
+
19
+ ### Method 3: Guided Transfer (WordPress.com feature)
20
+ WordPress.com Business/eCommerce plans offer guided transfer:
21
+ 1. Request transfer in WordPress.com settings
22
+ 2. WordPress.com packages site files and database
23
+ 3. Download package and import to new hosting
24
+
25
+ ## Self-Hosted → Self-Hosted
26
+
27
+ ### Method 1: Full Server Migration (Recommended)
28
+ ```bash
29
+ # On source
30
+ mysqldump -u root -p wordpress_db > backup.sql
31
+ tar -czf wp-files.tar.gz -C /var/www/html .
32
+
33
+ # Transfer
34
+ scp backup.sql wp-files.tar.gz user@destination:/tmp/
35
+
36
+ # On destination
37
+ mysql -u root -p new_db < /tmp/backup.sql
38
+ tar -xzf /tmp/wp-files.tar.gz -C /var/www/html/
39
+ wp search-replace 'old-url.com' 'new-url.com' --all-tables
40
+ ```
41
+
42
+ ### Method 2: Plugin-Based Migration
43
+ Plugins like All-in-One WP Migration, Duplicator, or UpdraftPlus:
44
+ 1. Install migration plugin on source
45
+ 2. Create migration package
46
+ 3. Install same plugin on destination
47
+ 4. Import package
48
+ 5. Update URLs
49
+
50
+ ### Method 3: API-Based Content Transfer
51
+ For content-only migration between two accessible sites:
52
+ 1. Enumerate content on source via `list_content`
53
+ 2. For each content piece: `get_content` → transform → `create_content` on destination
54
+ 3. Handle media separately: download from source, upload to destination
55
+ 4. Update internal links
56
+
57
+ ## Content-Only Migrations
58
+
59
+ ### WXR (WordPress eXtended RSS)
60
+ - Standard WordPress export format
61
+ - Includes: posts, pages, comments, categories, tags, custom fields
62
+ - Does NOT include: themes, plugins, settings, users (partial)
63
+ - Good for: Moving content between WordPress installations
64
+
65
+ ### REST API Transfer
66
+ - Programmatic content transfer via WP REST Bridge
67
+ - Includes: any content accessible via API
68
+ - Advantage: Can transform content during transfer
69
+ - Advantage: Can selectively migrate (filter by date, category, etc.)
70
+
71
+ ### Database-Level Transfer
72
+ - Direct database export/import
73
+ - Includes: everything in the database
74
+ - Requires: URL search-replace after transfer
75
+ - Risk: Higher, as database structure must match
76
+
77
+ ## URL Search and Replace
78
+
79
+ After any migration, URLs in the database need updating:
80
+
81
+ ### Serialized Data Safe Methods
82
+ ```bash
83
+ # wp-cli (recommended)
84
+ wp search-replace 'https://old.com' 'https://new.com' --all-tables --precise
85
+
86
+ # Better Search Replace plugin (GUI-based)
87
+ # Settings → Better Search Replace → search/replace in all tables
88
+ ```
89
+
90
+ ### Never Use Raw SQL for URL Replace
91
+ ```sql
92
+ -- DON'T DO THIS — breaks serialized data
93
+ UPDATE wp_posts SET post_content = REPLACE(post_content, 'old.com', 'new.com');
94
+ ```
95
+ Serialized PHP data (in wp_options, wp_postmeta) contains string length prefixes. Raw SQL REPLACE corrupts these.
96
+
97
+ ## DNS Migration Checklist
98
+
99
+ 1. **48h before**: Lower TTL to 300 (5 minutes)
100
+ 2. **Migration day**: Perform migration, verify on new host
101
+ 3. **DNS switch**: Update A record to new host IP
102
+ 4. **Monitor**: Check propagation via DNS checker tools
103
+ 5. **48h after**: Raise TTL back to 3600 (1 hour)
104
+ 6. **1 week after**: Decommission old hosting (if confirmed working)
@@ -0,0 +1,86 @@
1
+ # Hostinger Migration Reference
2
+
3
+ ## Using hosting_importWordpressWebsite
4
+
5
+ The Hostinger MCP provides `hosting_importWordpressWebsite` for full site imports.
6
+
7
+ ### Input Requirements
8
+ - **Archive file**: zip or tar.gz containing WordPress files
9
+ - **SQL dump**: Database backup file
10
+
11
+ ### Preparation
12
+
13
+ #### 1. Export Database from Source
14
+ ```bash
15
+ # Via SSH on source server
16
+ mysqldump -u [db_user] -p [db_name] > /tmp/site-backup.sql
17
+
18
+ # Or via wp-cli
19
+ wp db export /tmp/site-backup.sql
20
+ ```
21
+
22
+ #### 2. Package WordPress Files
23
+ ```bash
24
+ # From WordPress root directory
25
+ tar -czf /tmp/wp-files.tar.gz -C /path/to/wordpress .
26
+
27
+ # Or selective (wp-content only, faster)
28
+ tar -czf /tmp/wp-content.tar.gz -C /path/to/wordpress/wp-content .
29
+ ```
30
+
31
+ #### 3. Import to Hostinger
32
+ Use `hosting_importWordpressWebsite` with:
33
+ - The archive file path
34
+ - The SQL dump file path
35
+
36
+ **WARNING**: This overwrites the existing WordPress installation on the destination.
37
+
38
+ ## Post-Import Steps
39
+
40
+ ### URL Search and Replace
41
+ After migration, update URLs in the database:
42
+
43
+ ```bash
44
+ # Via wp-cli on Hostinger (SSH)
45
+ wp search-replace 'https://old-domain.com' 'https://new-domain.com' --all-tables
46
+
47
+ # Or using a plugin: Better Search Replace
48
+ ```
49
+
50
+ ### File Permissions
51
+ Hostinger standard permissions:
52
+ ```
53
+ Directories: 755
54
+ Files: 644
55
+ wp-config.php: 440
56
+ ```
57
+
58
+ ```bash
59
+ # Fix permissions via SSH
60
+ find /home/[user]/htdocs/[domain]/ -type d -exec chmod 755 {} \;
61
+ find /home/[user]/htdocs/[domain]/ -type f -exec chmod 644 {} \;
62
+ chmod 440 /home/[user]/htdocs/[domain]/wp-config.php
63
+ ```
64
+
65
+ ### DNS Configuration
66
+ After import, update DNS to point to Hostinger:
67
+ 1. Get Hostinger's IP via `hosting_listWebsites`
68
+ 2. Update A record via `DNS_updateDNSRecordsV1`
69
+ 3. Verify with `DNS_validateDNSRecordsV1`
70
+
71
+ ## Hostinger-Specific Paths
72
+
73
+ ```
74
+ Web root: /home/[username]/htdocs/[domain]/
75
+ Plugins: /home/[username]/htdocs/[domain]/wp-content/plugins/
76
+ Themes: /home/[username]/htdocs/[domain]/wp-content/themes/
77
+ Uploads: /home/[username]/htdocs/[domain]/wp-content/uploads/
78
+ wp-config: /home/[username]/htdocs/[domain]/wp-config.php
79
+ ```
80
+
81
+ ## Rollback
82
+
83
+ If migration fails:
84
+ 1. The original source site should still be intact (never delete source first)
85
+ 2. On Hostinger, re-import from a pre-migration backup
86
+ 3. Revert DNS changes if domain was already pointed to new host
@@ -0,0 +1,148 @@
1
+ ---
2
+ name: wp-performance
3
+ description: "Use when investigating or improving WordPress performance (backend-only agent): profiling and measurement (WP-CLI profile/doctor, Server-Timing, Query Monitor via REST headers), database/query optimization, autoloaded options, object caching, cron, HTTP API calls, and safe verification."
4
+ compatibility: "Targets WordPress 6.9+ (PHP 7.2.24+). Backend-only agent; prefers WP-CLI (doctor/profile) when available."
5
+ version: 1.0.0
6
+ source: "WordPress/agent-skills (GPL-2.0-or-later)"
7
+ ---
8
+
9
+ # WP Performance (backend-only)
10
+
11
+ ## When to use
12
+
13
+ Use this skill when:
14
+
15
+ - a WordPress site/page/endpoint is slow (frontend TTFB, admin, REST, WP-Cron)
16
+ - you need a profiling plan and tooling recommendations (WP-CLI profile/doctor, Query Monitor, Xdebug/XHProf, APMs)
17
+ - you’re optimizing DB queries, autoloaded options, object caching, cron tasks, or remote HTTP calls
18
+
19
+ This skill assumes the agent cannot use a browser UI. Prefer WP-CLI, logs, and HTTP requests.
20
+
21
+ ## Inputs required
22
+
23
+ - Environment and safety: dev/staging/prod, any restrictions (no writes, no plugin installs).
24
+ - How to target the install:
25
+ - WP root `--path=<path>`
26
+ - (multisite/site targeting) `--url=<url>`
27
+ - The performance symptom and scope:
28
+ - which URL/REST route/admin screen
29
+ - when it happens (always vs sporadic; logged-in vs logged-out)
30
+
31
+ ## Procedure
32
+
33
+ ### 0) Guardrails: measure first, avoid risky ops
34
+
35
+ 1. Confirm whether you may run write operations (plugin installs, config changes, cache flush).
36
+ 2. Pick a reproducible target (URL or REST route) and capture a baseline:
37
+ - TTFB/time with `curl` if possible
38
+ - WP-CLI profiling if available
39
+
40
+ Read:
41
+ - `references/measurement.md`
42
+
43
+ ### 1) Generate a backend-only performance report (deterministic)
44
+
45
+ Run:
46
+
47
+ - `node skills/wp-performance/scripts/perf_inspect.mjs --path=<path> [--url=<url>]`
48
+
49
+ This detects:
50
+
51
+ - WP-CLI availability and core version
52
+ - whether `wp doctor` / `wp profile` are available
53
+ - autoloaded options size (if possible)
54
+ - object-cache drop-in presence
55
+
56
+ ### 2) Fast wins: run diagnostics before deep profiling
57
+
58
+ If you have WP-CLI access, prefer:
59
+
60
+ - `wp doctor check`
61
+
62
+ It catches common production foot-guns (autoload bloat, SAVEQUERIES/WP_DEBUG, plugin counts, updates).
63
+
64
+ Read:
65
+ - `references/wp-cli-doctor.md`
66
+
67
+ ### 3) Deep profiling (no browser required)
68
+
69
+ Preferred order:
70
+
71
+ 1. `wp profile stage` to see where time goes (bootstrap/main_query/template).
72
+ 2. `wp profile hook` (optionally with `--url=`) to find slow hooks/callbacks.
73
+ 3. `wp profile eval` for targeted code paths.
74
+
75
+ Read:
76
+ - `references/wp-cli-profile.md`
77
+
78
+ ### 4) Query Monitor (backend-only usage)
79
+
80
+ Query Monitor is normally UI-driven, but it can be used headlessly via REST API response headers and `_envelope` responses:
81
+
82
+ - Authenticate (nonce or Application Password).
83
+ - Request REST responses and inspect headers (`x-qm-*`) and/or the `qm` property when using `?_envelope`.
84
+
85
+ Read:
86
+ - `references/query-monitor-headless.md`
87
+
88
+ ### 5) Fix by category (choose the dominant bottleneck)
89
+
90
+ Use the profile output to pick *one* primary bottleneck category:
91
+
92
+ - **DB queries** → reduce query count, fix N+1 patterns, improve indexes, avoid expensive meta queries.
93
+ - `references/database.md`
94
+ - **Autoloaded options** → identify the biggest autoloaded options and stop autoloading large blobs.
95
+ - `references/autoload-options.md`
96
+ - **Object cache misses** → introduce caching or fix cache key/group usage; add persistent object cache where appropriate.
97
+ - `references/object-cache.md`
98
+ - **Remote HTTP calls** → add timeouts, caching, batching; avoid calling remote APIs on every request.
99
+ - `references/http-api.md`
100
+ - **Cron** → reduce due-now spikes, de-duplicate events, move heavy tasks out of request paths.
101
+ - `references/cron.md`
102
+
103
+ ### 6) Verify (repeat the same measurement)
104
+
105
+ - Re-run the same `wp profile` / `wp doctor` / REST request.
106
+ - Confirm the performance delta and that behavior is unchanged.
107
+ - If the fix is risky, ship behind a feature flag or staged rollout when possible.
108
+
109
+ ## WordPress 6.9 performance improvements
110
+
111
+ Be aware of these 6.9 changes when profiling:
112
+
113
+ **On-demand CSS for classic themes:**
114
+ - Classic themes now get on-demand CSS loading (previously only block themes had this).
115
+ - Reduces CSS payload by 30-65% by only loading styles for blocks actually used on the page.
116
+ - If you're profiling a classic theme, this should already be helping.
117
+
118
+ **Block themes with no render-blocking resources:**
119
+ - Block themes that don't define custom stylesheets (like Twenty Twenty-Three/Four) can now load with zero render-blocking CSS.
120
+ - Styles come from global styles (theme.json) and separate block styles, all inlined.
121
+ - This significantly improves LCP (Largest Contentful Paint).
122
+
123
+ **Inline CSS limit increased:**
124
+ - The threshold for inlining small stylesheets has been raised, reducing render-blocking resources.
125
+
126
+ Reference: https://make.wordpress.org/core/2025/11/18/wordpress-6-9-frontend-performance-field-guide/
127
+
128
+ ## Verification
129
+
130
+ - Baseline vs after numbers are captured (same environment, same URL/route).
131
+ - `wp doctor check` is clean (or improved) when applicable.
132
+ - No new PHP errors or warnings in logs.
133
+ - No cache flush is required for correctness (cache flush should be last resort).
134
+
135
+ ## Failure modes / debugging
136
+
137
+ - “No change” after code changes:
138
+ - you measured a different URL/site (`--url` mismatch), caches masked results, or opcode cache is stale
139
+ - Profiling data is noisy:
140
+ - eliminate background tasks, test with warmed caches, run multiple samples
141
+ - `SAVEQUERIES`/Query Monitor causes overhead:
142
+ - don’t run in production unless explicitly approved
143
+
144
+ ## Escalation
145
+
146
+ - If this is production and you don’t have explicit approval, do not:
147
+ - install plugins, enable `SAVEQUERIES`, run load tests, or flush caches during traffic
148
+ - If you need system-level profiling (APM, PHP profiler extensions), coordinate with ops/hosting.
@@ -0,0 +1,24 @@
1
+ # Autoloaded options
2
+
3
+ Autoloaded options are loaded on *every request*, so large autoload payloads can hurt performance site-wide.
4
+
5
+ ## Quick checks
6
+
7
+ - Total autoload bytes:
8
+ - `wp option list --autoload=on --format=total_bytes`
9
+ - Find biggest autoloaded options:
10
+ - `wp option list --autoload=on --fields=option_name,size_bytes | sort -n -k 2 | tail`
11
+
12
+ Docs:
13
+
14
+ - `wp option list`: https://wpcli.dev/docs/option/list
15
+ - `wp doctor` includes an `autoload-options-size` check:
16
+ - https://make.wordpress.org/cli/handbook/doctor-default-checks/
17
+
18
+ ## Fix patterns
19
+
20
+ - Stop autoloading large blobs:
21
+ - store large data in non-autoload options (autoload=off)
22
+ - move large computed data to transients/object cache
23
+ - Remove stale options left behind by removed plugins/themes (careful: confirm usage before deleting).
24
+
@@ -0,0 +1,20 @@
1
+ # WP-Cron performance
2
+
3
+ Use this file when cron causes spikes or request-time slowness.
4
+
5
+ Backend-only tools:
6
+
7
+ - `wp cron test` (spawning health)
8
+ - `wp cron event list`
9
+ - `wp cron event run --due-now`
10
+
11
+ Reference:
12
+
13
+ - WP-CLI cron command package: https://github.com/wp-cli/cron-command
14
+
15
+ Fix patterns:
16
+
17
+ - De-duplicate scheduled events and reduce frequency where possible.
18
+ - Ensure tasks are idempotent and short.
19
+ - Move heavy work off-request; cron that runs on page load can hurt TTFB.
20
+
@@ -0,0 +1,20 @@
1
+ # Database / query performance
2
+
3
+ Use this file when profiling points to DB time or high query counts.
4
+
5
+ Common fixes:
6
+
7
+ - Avoid N+1 query patterns (batch queries, prime caches, avoid per-row lookups).
8
+ - Prefer `fields => 'ids'` when you only need IDs.
9
+ - Avoid expensive meta queries where possible; consider indexing or schema changes.
10
+ - Use object caching for repeated reads.
11
+
12
+ Tools (backend-only):
13
+
14
+ - Query Monitor (REST headers/envelope) for query lists and stack traces.
15
+ - `wp db query` for targeted SQL/explain (be careful in prod).
16
+
17
+ References:
18
+
19
+ - Query Monitor plugin: https://wordpress.org/plugins/query-monitor/
20
+
@@ -0,0 +1,15 @@
1
+ # HTTP API (remote requests)
2
+
3
+ Use this file when profiling shows slow external requests (`wp_remote_get`, etc.).
4
+
5
+ Fix patterns:
6
+
7
+ - Add timeouts and fail-fast behavior.
8
+ - Cache responses where appropriate (transients/object cache).
9
+ - Batch requests and avoid calling remote APIs on every page load.
10
+ - Move heavy remote work to async (cron/queue) where possible.
11
+
12
+ Tooling:
13
+
14
+ - Query Monitor can report HTTP API calls (including timing) via REST envelope info.
15
+
@@ -0,0 +1,21 @@
1
+ # Measurement (profiling vs benchmarking)
2
+
3
+ Backend-only measurement options:
4
+
5
+ - **WP-CLI profiling** (`wp profile`): best for pinpointing slow hooks/stages without a browser.
6
+ - **WP-CLI doctor** (`wp doctor`): best for quick diagnostics (autoload bloat, debug constants, updates).
7
+ - **Query Monitor via REST**: use authenticated REST requests and inspect `x-qm-*` headers / `qm` envelope data.
8
+ - **Server-Timing** (Performance Lab): inspect `Server-Timing` headers via `curl -I` (when enabled).
9
+ - **APM/profilers**: New Relic, Datadog, Blackfire, Tideways, XHProf/Xdebug (requires server support).
10
+
11
+ Best practices:
12
+
13
+ - Always capture a baseline first.
14
+ - Keep the test scenario fixed (same URL/route, same user state, same data).
15
+ - Prefer multiple samples and medians over single runs.
16
+
17
+ References:
18
+
19
+ - Measuring performance handbook: https://make.wordpress.org/performance/handbook/measuring-performance/
20
+ - Benchmarking with Server-Timing: https://make.wordpress.org/performance/handbook/measuring-performance/benchmarking-server-timing/
21
+
@@ -0,0 +1,24 @@
1
+ # Object caching
2
+
3
+ Use this file when profiling indicates repeated queries or low cache hit rate.
4
+
5
+ ## Concepts
6
+
7
+ - Default WP object cache is per-request memory only.
8
+ - A persistent object cache “drop-in” (`wp-content/object-cache.php`) can persist cache across requests.
9
+
10
+ WP-CLI cache commands:
11
+
12
+ - https://wpcli.dev/docs/cache
13
+
14
+ Guardrails:
15
+
16
+ - `wp cache flush` can impact all sites in multisite and cause load spikes:
17
+ - https://wpcli.dev/docs/cache/flush
18
+
19
+ ## Fix patterns
20
+
21
+ - Cache expensive computed results (transients or object cache) with explicit invalidation.
22
+ - Avoid unbounded caches (set expirations or implement invalidation hooks).
23
+ - If adding a persistent object cache, coordinate with infra (Redis/Memcached) and test cache flush behavior.
24
+
@@ -0,0 +1,38 @@
1
+ # Query Monitor (headless / backend-only)
2
+
3
+ Query Monitor is UI-first, but it can expose useful data to backend-only tooling.
4
+
5
+ ## What it can show
6
+
7
+ Query Monitor can help debug:
8
+
9
+ - DB queries (slow/dupes/errors), hooks/actions, HTTP API calls, PHP errors
10
+
11
+ Plugin page:
12
+
13
+ - https://wordpress.org/plugins/query-monitor/
14
+
15
+ Configuration constants:
16
+
17
+ - https://querymonitor.com/help/configuration-constants/
18
+
19
+ ## REST API requests (no browser needed)
20
+
21
+ Query Monitor can add performance/error info to authenticated REST responses.
22
+
23
+ Docs:
24
+
25
+ - https://querymonitor.com/wordpress-debugging/rest-api-requests/
26
+
27
+ High-level approach:
28
+
29
+ 1. Authenticate (nonce or Application Password).
30
+ 2. Make a REST request and inspect response headers like `x-qm-overview-*`.
31
+ 3. If you request an enveloped response (`?_envelope`), you can get a `qm` property with:
32
+ - DB queries details, cache stats, HTTP API request details, etc.
33
+
34
+ ## Guardrails
35
+
36
+ - Query Monitor adds some overhead; don’t enable it in production without approval.
37
+ - If it’s already installed by your platform (e.g. VIP), you may need to grant `view_query_monitor`.
38
+
@@ -0,0 +1,22 @@
1
+ # Server-Timing (Performance Lab)
2
+
3
+ Use this file when you can enable Server-Timing metrics and want backend-only inspection via HTTP headers.
4
+
5
+ Performance Lab plugin:
6
+
7
+ - https://wordpress.org/plugins/performance-lab/
8
+
9
+ Benchmarking guidance:
10
+
11
+ - https://make.wordpress.org/performance/handbook/measuring-performance/benchmarking-server-timing/
12
+
13
+ Backend-only approach:
14
+
15
+ - Enable the relevant module/standalone plugin.
16
+ - Request a URL and inspect the `Server-Timing` header:
17
+ - `curl -sS -D - https://example.test/ -o /dev/null | rg -i \"^server-timing:\"`
18
+
19
+ Guardrails:
20
+
21
+ - Don’t enable experimental modules in production without approval.
22
+
@@ -0,0 +1,24 @@
1
+ # WP-CLI doctor (`wp doctor`)
2
+
3
+ Use this for quick “production readiness” checks.
4
+
5
+ ## Install (if missing)
6
+
7
+ - `wp package install wp-cli/doctor-command`
8
+
9
+ Docs:
10
+
11
+ - Default checks: https://make.wordpress.org/cli/handbook/doctor-default-checks/
12
+ - Customize checks: https://make.wordpress.org/cli/handbook/guides/doctor/doctor-customize-config/
13
+
14
+ ## Recommended usage
15
+
16
+ - `wp doctor check`
17
+ - `wp doctor list` (to see available checks)
18
+
19
+ Especially relevant to performance:
20
+
21
+ - `autoload-options-size` (autoloaded options threshold)
22
+ - `constant-savequeries-falsy` / `constant-wp-debug-falsy` (avoid perf-costly debug flags in prod)
23
+ - cron checks (count/duplicates)
24
+
@@ -0,0 +1,32 @@
1
+ # WP-CLI profiling (`wp profile`)
2
+
3
+ Use this when you need actionable profiling without a browser.
4
+
5
+ ## Install (if missing)
6
+
7
+ `wp profile` comes from a WP-CLI package:
8
+
9
+ - `wp package install wp-cli/profile-command`
10
+
11
+ Docs:
12
+
13
+ - https://wpcli.dev/docs/profile/stage
14
+ - https://wpcli.dev/docs/profile/hook
15
+ - https://wpcli.dev/docs/profile/eval
16
+
17
+ ## Recommended sequence
18
+
19
+ 1. Stage overview:
20
+ - `wp profile stage --fields=stage,time,cache_ratio [--url=<url>]`
21
+ 2. Hooks hotspot:
22
+ - `wp profile hook --spotlight [--url=<url>]`
23
+ - then drill into a specific hook:
24
+ - `wp profile hook init --spotlight [--url=<url>]`
25
+ 3. Targeted evaluation:
26
+ - `wp profile eval 'do_action(\"init\");' --hook=init`
27
+
28
+ Tips:
29
+
30
+ - Use `--url` to profile specific site/route behavior.
31
+ - Use `--skip-plugins` / `--skip-themes` to isolate culprit components (careful: behavior changes).
32
+