Title: WP_Privacy_Policy_Content::notice
Published: October 5, 2018
Last modified: August 20, 2026

---

# WP_Privacy_Policy_Content::notice( WP_Post|null $post = null )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#changelog)

Adds a notice with a link to the guide when editing the privacy policy page.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#parameters)󠁿

 `$post`[WP_Post](https://developer.wordpress.org/reference/classes/wp_post/)|nulloptional

The currently edited post.

Default:`null`

## 󠀁[Source](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#source)󠁿

    ```php
    public static function notice( $post = null ) {
    	if ( is_null( $post ) ) {
    		global $post;
    	} else {
    		$post = get_post( $post );
    	}

    	if ( ! ( $post instanceof WP_Post ) ) {
    		return;
    	}

    	if ( ! current_user_can( 'manage_privacy_options' ) ) {
    		return;
    	}

    	$current_screen = get_current_screen();
    	$policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );

    	// If the privacy policy page has been deleted, reset the option and bail.
    	if ( $policy_page_id && ! get_post( $policy_page_id ) ) {
    		update_option( 'wp_page_for_privacy_policy', 0 );
    		return;
    	}

    	if ( 'post' !== $current_screen->base || $policy_page_id !== $post->ID ) {
    		return;
    	}

    	$message = __( 'Need help putting together your new Privacy Policy page? Check out the guide for recommendations on what content to include, along with policies suggested by your plugins and theme.' );
    	$url     = esc_url( admin_url( 'options-privacy.php?tab=policyguide' ) );
    	$label   = __( 'View Privacy Policy Guide.' );

    	if ( get_current_screen()->is_block_editor() ) {
    		wp_enqueue_script( 'wp-notices' );
    		$action = array(
    			'url'   => $url,
    			'label' => $label,
    		);
    		wp_add_inline_script(
    			'wp-notices',
    			sprintf(
    				'wp.data.dispatch( "core/notices" ).createWarningNotice( "%s", { actions: [ %s ], isDismissible: false } )',
    				$message,
    				wp_json_encode( $action, JSON_HEX_TAG | JSON_UNESCAPED_SLASHES )
    			),
    			'after'
    		);
    	} else {
    		$message .= sprintf(
    			' <a href="%s" target="_blank">%s <span class="screen-reader-text">%s</span></a>',
    			$url,
    			$label,
    			/* translators: Hidden accessibility text. */
    			__( '(opens in a new tab)' )
    		);
    		wp_admin_notice(
    			$message,
    			array(
    				'type'               => 'warning',
    				'additional_classes' => array( 'inline', 'wp-pp-notice' ),
    			)
    		);
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-privacy-policy-content.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/class-wp-privacy-policy-content.php#L314)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/class-wp-privacy-policy-content.php#L314-L377)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_admin_notice()](https://developer.wordpress.org/reference/functions/wp_admin_notice/)`wp-includes/functions.php` |

Outputs an admin notice.

  | 
| [wp_add_inline_script()](https://developer.wordpress.org/reference/functions/wp_add_inline_script/)`wp-includes/functions.wp-scripts.php` |

Adds extra code to a registered script.

  | 
| [get_current_screen()](https://developer.wordpress.org/reference/functions/get_current_screen/)`wp-admin/includes/screen.php` |

Get the current screen object

  | 
| [wp_json_encode()](https://developer.wordpress.org/reference/functions/wp_json_encode/)`wp-includes/functions.php` |

Encodes a variable into JSON, with some confidence checks.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [esc_url()](https://developer.wordpress.org/reference/functions/esc_url/)`wp-includes/formatting.php` |

Checks and cleans a URL.

  | 
| [wp_enqueue_script()](https://developer.wordpress.org/reference/functions/wp_enqueue_script/)`wp-includes/functions.wp-scripts.php` |

Enqueues a script.

  | 
| [admin_url()](https://developer.wordpress.org/reference/functions/admin_url/)`wp-includes/link-template.php` |

Retrieves the URL to the admin area for the current site.

  | 
| [update_option()](https://developer.wordpress.org/reference/functions/update_option/)`wp-includes/option.php` |

Updates the value of an option that was already added.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  | 
| [get_post()](https://developer.wordpress.org/reference/functions/get_post/)`wp-includes/post.php` |

Retrieves post data given a post ID or post object.

  |

[Show 9 more](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/wp_privacy_policy_content/notice/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.0.0](https://developer.wordpress.org/reference/since/5.0.0/) | The `$post` parameter was made optional. | 
| [4.9.6](https://developer.wordpress.org/reference/since/4.9.6/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_privacy_policy_content%2Fnotice%2F)
before being able to contribute a note or feedback.