# "Privacy Policy Last Updated" Date Shortcode

> Adds a [privacy_policy_updated] shortcode that prints the date your privacy policy page was last changed, so the date on the page is always correct.

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

## Code

```php
add_shortcode( 'privacy_policy_updated', function ( $atts ) {
    $atts = shortcode_atts( array(
        'format' => get_option( 'date_format' ),
        'prefix' => 'Last updated: ',
    ), $atts, 'privacy_policy_updated' );

    $page_id = (int) get_option( 'wp_page_for_privacy_policy' );

    if ( ! $page_id || 'publish' !== get_post_status( $page_id ) ) {
        return '';
    }

    return '<p class="wpide-policy-updated">' . esc_html( $atts['prefix'] . get_the_modified_date( $atts['format'], $page_id ) ) . '</p>';
} );
```

## Notes

Use [privacy_policy_updated format="F j, Y"] to choose a date format; it defaults to your site's date format.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find ""Privacy Policy Last Updated" Date Shortcode" 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/
