diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 640f4b63436af..52882a8d7b7ac 100644
--- a/src/wp-includes/functions.php
+++ b/src/wp-includes/functions.php
@@ -7142,7 +7142,10 @@ function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = ar
  * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
  */
 function send_frame_options_header() {
-	header( 'X-Frame-Options: SAMEORIGIN' );
+	if ( ! headers_sent() ) {
+		header( 'X-Frame-Options: SAMEORIGIN' );
+		header( "Content-Security-Policy: frame-ancestors 'self';" );
+	}
 }
 
 /**
