Magic Login Pro includes powerful WP-CLI support to manage login links, QR code generation, bulk user operations, and plugin settings. This allows for automation, remote control, and developer-friendly workflows in server environments.
Create Magic Login Links for a User #
Generate one or more magic login URLs for any existing user by their ID, login, or email:
wp magic-login create <user> [--count=<count>] [--redirect-to=<url>] [--send] [--qr] [--qr-img]
Parameters #
--count: Number of links to generate (default: 1).--redirect-to: Optional redirect URL after login.--send: Sends the login link to the user’s email.--qr: Outputs the QR code URL for each login link.--qr-img: Outputs the QR code as an HTML<img>tag.
Example:
wp magic-login create admin --count=1 --redirect-to='https://example.org/' --qr
and output will be something like
https://example.org/wp-login.php?user_id=1&token=...
QR: https://example.org/magic-login-qr?url=...
In version 1.3.1, `redirect-to` parameter has been added! You can easily specify the redirection URLs.
Bulk Generate Login Links by Role #
Generate login links for all users of a specific role and optionally export them:
wp magic-login bulk-create [--role=<role>] [--redirect-to=<url>] [--send] [--format=<format>] [--qr] [--qr-img]
Parameters #
--role: Restrict generation to users with a specific role.--redirect-to: Optional redirect URL.--send: Emails each user their link.--format: Output format (table,csv,json,yaml). Default:table.--qr: Adds a QR code URL to each record.--qr-img: Adds an<img>tag with QR code to each record.
Example:
wp magic-login bulk-create --role=subscriber --format=csv --qr > login-links.csv
Export Plugin Settings #
Export your current plugin settings to a .json file:
wp magic-login export-settings [--file=<file>] [--include-sensitive] [--include-license]
Parameters #
--file: Path to export file (default:magic-login-settings.json).--include-sensitive: Includes decrypted API credentials.--include-license: Includes license key.
Example:
wp magic-login export-settings --file=config.json --include-sensitive --include-license
Import Plugin Settings #
Import a previously exported settings file:
wp magic-login import-settings --file=<file> [--activate-license]
Parameters #
--file: Path to a.jsonsettings file.--activate-license: Activates license from the file.
Example
wp magic-login import-settings --file=config.json --activate-license
Reset Plugin Data #
Reset plugin data using the following command:
wp magic-login reset <what>
Options for <what>
settings: Reset plugin settings.license: Reset stored license key.all-tokens: Delete all user login tokens.
Example:
wp magic-login reset all-tokens
Notes #
- All CLI operations assume you have the appropriate permissions.
- Login links generated via CLI bypass IP restrictions.
- Use
--include-sensitiveand--include-licenseflags cautiously in production environments. - WP-CLI is recommended for advanced users, CI/CD workflows, and bulk administration tasks.