Ettic Docs
MagicAuthDevelopers

Constants

wp-config.php flags that change MagicAuth's behaviour.

Three constants live in wp-config.php and are read by MagicAuth at runtime. Define them above the /* That's all, stop editing! */ line.

MAGICAUTH_DISABLE

Skip MagicAuth's Plugin::boot() entirely. The plugin code is still present, but no hooks are wired and the sign-in surfaces revert to default WordPress behaviour.

define( 'MAGICAUTH_DISABLE', true );

When to use it

  • Emergency lockout recovery when the password link and ?magicauth=off are insufficient. See Troubleshooting / Lockout recovery.
  • Temporarily disabling MagicAuth on staging or local environments without deactivating the plugin.

Behaviour

The activation and deactivation hooks still run when the plugin is activated or deactivated through wp-admin. Only the runtime boot routine is skipped. Database state and settings are preserved.

MAGICAUTH_KEEP_DATA

Prevent the uninstall handler from dropping the database table, deleting the settings option, and removing per-user magicauth_disabled meta.

define( 'MAGICAUTH_KEEP_DATA', true );

When to use it

  • GDPR or records-retention requirements where you need to keep the request log even after uninstall.
  • Reinstalling MagicAuth after a major change without losing settings.

What uninstall does without it

By default, the user-initiated Delete action in wp-admin drops:

  • {prefix}magicauth_requests. The token table.
  • magicauth_settings and magicauth_db_version options.
  • magicauth_disabled user meta sitewide.

Deactivating the plugin (without deleting) never touches data, with or without this constant.

MAGICAUTH_TESTING

Test-only flag. Do not set this in production. It disables exit calls in redirect paths and enables Throttle::reset_all().

define( 'MAGICAUTH_TESTING', true );

What it changes

When set, MagicAuth:

  • Disables exit calls in Controller::redirect_safe() so PHPUnit tests can assert on redirects without process termination.
  • Runs magicauth_dispatch_after_response callbacks synchronously instead of deferring via register_shutdown_function, so tests see side effects immediately.
  • Enables Throttle::reset_all() (otherwise gated behind the magicauth_throttle_allow_reset_all filter).

Where it's used

The test suite at tests/phpunit/ sets this constant in its bootstrap. Production code paths are unaffected when the constant is unset.

On this page