diff --git a/lib/compat/wordpress-6.5/compat.php b/lib/compat/wordpress-6.5/compat.php
index 78447927125894..39edaef83e5cc8 100644
--- a/lib/compat/wordpress-6.5/compat.php
+++ b/lib/compat/wordpress-6.5/compat.php
@@ -36,3 +36,18 @@ function array_is_list( $arr ) {
return true;
}
}
+
+/**
+ * Sets a global JS variable used to flag whether to direct the Site Logo block's admin urls
+ * to the Customizer. This allows Gutenberg running on versions of WordPress < 6.5.0 to
+ * support the previous location for the Site Icon settings. This function should not be
+ * backported to core, and should be removed when the required WP core version for Gutenberg
+ * is >= 6.5.0.
+ */
+function gutenberg_add_use_customizer_site_logo_url_flag() {
+ if ( ! is_wp_version_compatible( '6.5' ) ) {
+ wp_add_inline_script( 'wp-block-editor', 'window.__experimentalUseCustomizerSiteLogoUrl = true', 'before' );
+ }
+}
+
+add_action( 'admin_init', 'gutenberg_add_use_customizer_site_logo_url_flag' );
diff --git a/packages/block-library/src/site-logo/edit.js b/packages/block-library/src/site-logo/edit.js
index fe4146406ddf60..079811f0aae958 100644
--- a/packages/block-library/src/site-logo/edit.js
+++ b/packages/block-library/src/site-logo/edit.js
@@ -268,6 +268,14 @@ const SiteLogo = ( {
);
+ // Support the previous location for the Site Icon settings. To be removed
+ // when the required WP core version for Gutenberg is >= 6.5.0.
+ const shouldUseNewUrl = ! window?.__experimentalUseCustomizerSiteLogoUrl;
+
+ const siteIconSettingsUrl = shouldUseNewUrl
+ ? siteUrl + '/wp-admin/options-general.php'
+ : siteUrl + '/wp-admin/customize.php?autofocus[section]=title_tagline';
+
const syncSiteIconHelpText = createInterpolateElement(
__(
'Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. To use a custom icon that is different from your site logo, use the Site Icon settings.'
@@ -276,10 +284,7 @@ const SiteLogo = ( {
a: (
// eslint-disable-next-line jsx-a11y/anchor-has-content