Hard-coding your license key
You can put your GravityKit license keys in wp-config.php instead of entering them on the Manage Your Kit page. GravityKit reads the keys from there. When the license data stored on the site becomes unreadable, for example after a migration changes the site’s secret keys, GravityKit adds those keys back by itself.
Add your keys to wp-config.php #
Add this line to wp-config.php, above the line that says That's all, stop editing!, and replace YOUR_LICENSE_KEY with your key:
define( 'GRAVITYKIT_LICENSES', 'YOUR_LICENSE_KEY' );To add more than one key, list them:
define( 'GRAVITYKIT_LICENSES', [ 'FIRST_LICENSE_KEY', 'SECOND_LICENSE_KEY' ] );Your keys are on the Licenses page of your GravityKit account. If you haven’t edited wp-config.php before, see Editing wp-config.php in the WordPress documentation.
Sites that already use the older GRAVITYVIEW_LICENSE_KEY constant don’t need to change anything. GravityKit still reads that constant the same way.
What GravityKit does with the keys #
The next time an administrator opens the WordPress dashboard, GravityKit checks each key with the GravityKit server and saves it with the site’s other licenses. It also activates any key that isn’t active on any site yet. GravityKit checks new keys at most once every 5 minutes, so a key can take a few minutes to appear. If the key’s status on Manage Your Kit doesn’t read Active yet, click Refresh next to the Manage Your Kit heading.
When a key is already active on another site, GravityKit saves it without activating it, and its status reads Not Activated for This Site. To use one of the license’s activations here, go to GravityKit, then Manage Your Kit, and click Activate on the key’s row.
On Manage Your Kit, a hard-coded key shows Set in wp-config.php where other keys have a Deactivate link. You can only change or remove it in wp-config.php.

A key you entered on Manage Your Kit before adding it to wp-config.php keeps its Deactivate link. As long as the key is in wp-config.php, GravityKit adds it back on a later visit after you deactivate it, and after a key change.
When a key from wp-config.php never shows up on Manage Your Kit, check it for typos. GravityKit skips keys that the GravityKit server doesn’t recognize and checks them again on a later visit, at most once every 5 minutes.
WordPress Multisite #
On a Multisite network, a hard-coded key is a network-wide license. It covers every site on the network, including sites you add later, and it uses one activation, recorded for the network’s main address. Network administrators see its row on Manage Your Kit, with a Network badge next to the status. Administrators of individual sites on the network don’t see it. See Multisite and GravityKit licenses for how network-wide licenses differ from per-site ones.
Hard-coded keys come back after a key change #
If the site’s WordPress secret keys (salts) change, or you add or change GRAVITYKIT_SECRET_KEY, the licenses saved on the site can no longer be read. Keys in wp-config.php come back by themselves. GravityKit adds them again on the next dashboard visit and checks at most once every 5 minutes.
After a move to a new address, a key whose license is still active elsewhere, such as at the old address, comes back as Not Activated for This Site. Click Activate on its row.
Keys you entered on Manage Your Kit have to be entered again. See The license key keeps disappearing for the causes and how to prevent them.
Removing a hard-coded key #
Delete the key from wp-config.php. GravityKit removes it from Manage Your Kit the next time an administrator opens the dashboard.
The site still holds one of the license’s activations after that. To free it, sign in to your GravityKit account, open Licenses, click the × next to the site’s address on the license, and confirm.
Who can see hard-coded keys #
GravityKit stores license keys encrypted in the database, and the WordPress dashboard shows only the first and last few characters of each key. Hard-coding a key doesn’t change that, but anyone who can read wp-config.php can see the full key there.