Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions src/wp-admin/options-privacy.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ static function ( $body_class ) {
check_admin_referer( $action );

if ( 'set-privacy-page' === $action ) {
$privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? (int) $_POST['page_for_privacy_policy'] : 0;
$previous_privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
$privacy_policy_page_id = isset( $_POST['page_for_privacy_policy'] ) ? (int) $_POST['page_for_privacy_policy'] : 0;
update_option( 'wp_page_for_privacy_policy', $privacy_policy_page_id );

$privacy_page_updated_message = __( 'Privacy Policy page updated successfully.' );
$privacy_page_message_type = 'success';

if ( $privacy_policy_page_id ) {
$privacy_page_updated_message = __( 'Privacy Policy page updated successfully.' );

/*
* Don't always link to the menu customizer:
*
Expand All @@ -75,9 +78,16 @@ static function ( $body_class ) {
esc_url( add_query_arg( 'autofocus[panel]', 'nav_menus', admin_url( 'customize.php' ) ) )
);
}
} elseif ( $previous_privacy_policy_page_id ) {
// A previously set Privacy Policy page was cleared.
$privacy_page_updated_message = __( 'Privacy Policy page removed.' );
} else {
// No Privacy Policy page was set before, and none is set now.
$privacy_page_updated_message = __( 'No Privacy Policy page is currently set.' );
$privacy_page_message_type = 'info';
}

add_settings_error( 'page_for_privacy_policy', 'page_for_privacy_policy', $privacy_page_updated_message, 'success' );
add_settings_error( 'page_for_privacy_policy', 'page_for_privacy_policy', $privacy_page_updated_message, $privacy_page_message_type );
} elseif ( 'create-privacy-page' === $action ) {

if ( ! class_exists( 'WP_Privacy_Policy_Content' ) ) {
Expand Down
Loading