diff --git a/wp-admin/includes/misc.php b/wp-admin/includes/misc.php index d0dc33b913..44045a47f3 100644 --- a/wp-admin/includes/misc.php +++ b/wp-admin/includes/misc.php @@ -1619,7 +1619,11 @@ final class WP_Privacy_Policy_Content { * @param WP_Post|null $post The currently edited post. Default null. */ public static function notice( $post = null ) { - $post = get_post( $post ); + if ( is_null( $post ) ) { + global $post; + } else { + $post = get_post( $post ); + } if ( ! ( $post instanceof WP_Post ) ) { return; @@ -1631,30 +1635,52 @@ final class WP_Privacy_Policy_Content { $policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); - if ( ! $policy_page_id || $policy_page_id != $post->ID ) { + if ( ! $policy_page_id || $policy_page_id !== $post->ID ) { return; } - ?> -
-

- Check out our guide%3$s for recommendations on what content to include, along with policies suggested by your plugins and theme.' ), - esc_url( admin_url( 'tools.php?wp-privacy-policy-guide=1' ) ), - 'target="_blank"', - sprintf( - ' %s', - /* translators: accessibility text */ - __( '(opens in a new tab)' ) - ) - ); - ?> -

-
- 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 ) + ), + 'after' + ); + } else { + ?> +
+

+ %3$s%4$s' ), + $url, + 'target="_blank"', + $label, + sprintf( + ' %s', + /* translators: accessibility text */ + __( '(opens in a new tab)' ) + ) + ); + ?> +

+
+