WP-CLI Commands

Overview

Fatal Error Notify includes WP-CLI support for managing plugin settings from the command line. This is especially useful for automated deployments, multisite management, and scripting.

Available Commands

get_options

Returns all plugin options for the current site.

wp fatal-error-notify get_options

get_option

Returns the value of a specific option.

wp fatal-error-notify get_option notification_email
wp fatal-error-notify get_option levels
wp fatal-error-notify get_option slack_notifications

update_option

Updates a specific option value.

# Simple string value
wp fatal-error-notify update_option notification_email [email protected]

# Array value (use JSON format)
wp fatal-error-notify update_option levels '{"1":true,"2":false,"4":true}'

For options that are stored as arrays (like levels or plugins), use JSON-formatted values. Run get_option first on the field you want to update to see its current format.

Multisite Bulk Updates

On multisite, you can update settings across all sites using xargs:

# Update notification email on all sites
wp site list --field=url | xargs -n1 -I {} sh -c 'wp --url={} fatal-error-notify update_option notification_email [email protected]'

# Enable Slack notifications on all sites
wp site list --field=url | xargs -n1 -I {} sh -c 'wp --url={} fatal-error-notify update_option slack_notifications 1'

This is useful for deploying consistent error monitoring settings across an entire network.