DocsoPWA14. WP-CLI Commands
Developer

14. WP-CLI Commands

oPWAorravo.com/docs/opwa/14-wp-cli-commands

All commands use the wp opwa namespace.

wp opwa clear-cache

Bumps sw_version by 1, forcing all clients to delete and re-create caches on next SW activation.

bashwp opwa clear-cache
# Success: Cache cleared. New SW version: 4

wp opwa send-push

Send a push notification to all subscribers.

bashwp opwa send-push --title="New post" --body="Check out our latest article" --url="https://site.com/post"
# Success: Done. Sent: 142 / Failed: 3 / Total: 145

Options:

FlagRequiredDescription
--titleYesNotification title
--bodyYesNotification body
--urlNoClick-through URL
--iconNoIcon URL

wp opwa list-subscribers

List all push subscribers.

bashwp opwa list-subscribers
wp opwa list-subscribers --format=json
wp opwa list-subscribers --format=csv

Output columns: ID, Device, User ID, Subscribed, Endpoint (truncated).


wp opwa generate-icons

Generate all PWA icon sizes from a WordPress attachment.

bashwp opwa generate-icons 42
# Success: Icons generated: 72x72, 96x96, 128x128, 144x144, 152x152, 192x192, 384x384, 512x512, maskable

The attachment must be a PNG or JPG at least 512×512 pixels.


wp opwa generate-vapid

Generate a new EC P-256 VAPID key pair and save it to the plugin options.

bashwp opwa generate-vapid
# Prompts for confirmation, then:
# Success: VAPID keys generated and saved.
# Public key: BFi2R7...

wp opwa generate-vapid --yes   # Skip confirmation

wp opwa status

Display a summary of current plugin configuration.

bashwp opwa status

Output table:

SettingValue
Plugin version1.0.0
SW version3
App nameMy Site
VAPID configuredYes
Push subscribers142
Pages strategynetwork-first

14. WP-CLI Commands — oPWA Docs — Orravo