ProcessWire
Recipes_

Resetting admin password via API

Problem

For some reason, you have managed to lock yourself out of a site you are currently developing.

Solution

Paste the following into a file (e.g. “reset.php”) in the root folder of the site, then run it.

ProcessWire version >= 2.6.9


require "index.php";
$admin = $users->get('admin'); // or whatever your username is
$admin->setAndSave('pass', 'yo123456');

ProcessWire version < 2.6.9


require "index.php";
$admin = wire('users')->get('admin');
$admin->setOutputFormatting(false);
$admin->set('pass', 'yo12345');
$admin->save('pass');

Resources