Understanding the Encrypted API Keys in WordPress 7.2 Secrets API

Try Our Free Tools!
Master the web with Free Tools that work as hard as you do. From Text Analysis to Website Management, we empower your digital journey with expert guidance and free, powerful tools.

WordPress 7.2 Set to Introduce Enhanced Secrets API

On December 8, 2026, WordPress 7.2 will unveil a new Secrets API designed to securely store API keys, tokens, and passwords in an encrypted format within the database, rather than leaving them exposed as plaintext in the options table, as detailed in the November developer roundup published on November 13.

This functionality remains disabled on pre-existing sites until a new encryption key is integrated into wp-config.php.

Concerningly, a long-time core contributor has advocated for its removal from the upcoming release, a sentiment echoed by WordPress co-founder Matt Mullenweg.

The API provides plugins with four critical functions: wp_set_secret(), wp_get_secret(), wp_delete_secret(), and wp_retire_secret_version().

Encrypted credentials are retrieved as a WP_Secret object, which conceals sensitive values in logs and debug outputs until explicitly revealed via the reveal() function.

Moreover, WordPress retains one previous version of each secret to facilitate seamless key rotations without incurring downtime. The naming convention for secrets will follow the structure: plugin-slug/secret-name.

Internally, values are encrypted employing libsodium’s XChaCha20-Poly1305 cipher, while still residing within the options tables, according to a developer note authored by core contributor Eric Mann on November 11.

Each secret’s key is safeguarded by a random root key, which itself is encrypted through the newly introduced WP_SECRETS_KEY constant in wp-config.php.

However, the security measures are not foolproof. Although database dumps, leaked backups, or unauthorized SQL injections will only yield ciphertext, the note clarifies that any code executed on the site can access any secret, as the key resides on the same server as the data being protected. A compromised or malevolent plugin remains a risk.

Upgraded Sites Begin Without an Encryption Key

The roundup indicates that new installations will automatically generate aWP_SECRETS_KEY, while existing sites are advised by Site Health on how to incorporate it.

The Make WordPress Hosting team’s advisory, released on November 12, specifies that only the browser-based installer writes the key.

WP-CLI commands, one-click installers, and host provisioning scripts are not currently equipped to do so, leaving sites upgraded from version 7.1.4 without a key entirely.

This lack of a valid key has critical implications, especially following Beta 5, which eliminated the previous fallback option utilizing login salts.

Without an operational key, any attempt to read or write data results in an secret_key_unavailable error.

A user, Ssebuwufu Moses, reported on November 14 that a Softaculous installation on shared cPanel hosting was devoid of a key after upgrading to 7.2 Beta 5.

Notably, Site Health assessed this shortfall as “Recommended” rather than “Critical.” Upon generating a key, Moses discovered that the stored value was untraceable in plaintext across six database reviews.

To ensure the feature is functional from day one, site owners must generate a random 32-byte, base64-encoded value using the command (openssl rand -base64 32) and define it as WP_SECRETS_KEY in wp-config.php.

This key must accompany the site through all migrations, staging instances, and restorations. Modifying or deleting it renders all stored secrets unreadable until the initial value is restored.

Plugin developers are advised to verify the availability of the API wp_is_secrets_api_available() prior to any migration.

They should employ wp_import_option_as_secret() to transfer existing options. Credentials brought in from plaintext are flagged for immediate rotation, due to the risk posed by their previous storage in unencrypted backups.

Calls to Remove the API from the 7.2 Release

The inclusion of the Secrets API in the release has sparked controversy. Core contributor Ryan McCue has called for its exclusion from version 7.2, contending that “secrets are things that are provided to the application, not managed by it,” stressing that databases encrypted at rest already provide similar safeguards.

Mullenweg concurred with these reservations and asserted that it was an ill-advised moment to render confidential data a potential target.

In response, Mann defended the feature’s retention, asserting that the storage layer had been redesigned to allow hosts to deliver read-only, platform-managed secrets via a secrets.php drop-in.

He indicated that the majority of WordPress sites lack a dedicated channel for credential delivery. The hosting team has urged testers to assess the API during Beta 5 ahead of the forthcoming Release Candidate 1 set for November 17, at which point any amendments will require committer endorsement.

This discourse follows a series of core security updates. WordPress 7.1.4 addressed 22 vulnerabilities on October 28, shortly after 7.1.3 rectified a SQL injection flaw while 7.1.2 mitigated a critical file inclusion vulnerability.

Encryption at rest would provide a buffer against SQL injection attacks, yet the most severe core bug of the year, the WP2Shell pre-authentication chain, ultimately led to code execution—a scenario where the protections of the Secrets API fall short.

Additional changes in 7.2 that could disrupt existing code are relatively minor. Icons in the admin bar and sidebar will transition to inline SVGs, replacing Dashicons, potentially causing any CSS that modifies or conceals icons to ::before to malfunction.

WordPress 7.2 logo displayed on a digital interface with blue abstract background graphics.

Additionally, administration scripts and styles will be loaded individually, deprecating the previously utilized load-scripts.php and load-styles.php. A new /random URL will redirect users to a random published post.

It is worth noting that version 7.2 lacks an administrative interface for managing secrets; however, one is anticipated for a subsequent release.

There has yet to be an official statement from WordPress regarding possible modifications to the API prior to the release of RC1, which will coincide with the launch of the 7.2 Field Guide.

Source link: Cyberkendra.com.

Disclosure: This article is for general information only and is based on publicly available sources. We aim for accuracy but can't guarantee it. The views expressed are the author's and may not reflect those of the publication. Some content was created with help from AI and reviewed by a human for clarity and accuracy. We value transparency and encourage readers to verify important details. This article may include affiliate links. If you buy something through them, we may earn a small commission — at no extra cost to you. All information is carefully selected and reviewed to ensure it's helpful and trustworthy.

Reported By

Souvik Banerjee

I’m Souvik Banerjee from Kolkata, India. As a Marketing Manager at RS Web Solutions (RSWEBSOLS), I specialize in digital marketing, SEO, programming, web development, and eCommerce strategies. I also write tutorials and tech articles that help professionals better understand web technologies.
Share the Love
Related News Worth Reading