# "Cookie Settings" Link That Reopens the Consent Banner

> Adds a [cookie_settings_link] shortcode that lets visitors change their cookie choice at any time: it clears the stored choice and reloads the page so the consent banner shows again.

- Type: PHP
- Runs: Frontend only
- Category: [Privacy & Cookies](https://wpide.com/library/category/privacy/)
- Tags: cookies, consent, shortcode
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/privacy-cookie-settings-link/

## Code

```php
add_shortcode( 'cookie_settings_link', function ( $atts ) {
    $atts = shortcode_atts( array( 'text' => 'Cookie settings' ), $atts, 'cookie_settings_link' );

    return '<button type="button" class="wpide-cookie-settings" onclick="document.cookie=\'wpide_consent=;path=/;max-age=0\';location.reload();" style="background:none;border:0;padding:0;color:inherit;text-decoration:underline;cursor:pointer;font:inherit;">' . esc_html( $atts['text'] ) . '</button>';
} );
```

## Notes

Made for the simple wpide_consent cookie banner; consent plugins usually provide their own settings link.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""Cookie Settings" Link That Reopens the Consent Banner" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
