Skip to main content

benecaster_delete_secret()

Utilities Free
benecaster_delete_secret( string $addon_slug, string $name ): bool

Removes a secret an add-on stored with benecaster_store_secret(). Storing an empty value does the same.

Parameters

Name Type Default Required Description
addon_slug string — Yes Your add-on's slug, in either form (my-addon or benecaster-addon-my-addon).
name string — Yes The name the secret was stored under.

Return Value

Type: bool

true when a secret was stored and has been removed; false when there was none.

Example

if ( ! empty( $request['remove_api_key'] ) ) {
    benecaster_delete_secret( 'my-addon', 'api_key' );
}

Notes

There is no capability check: check manage_options on the route that calls it.

Need this built rather than just documented? See our services →