From 39dd4149cd46793b7a0c3e6e310bd6ee5c5a318c Mon Sep 17 00:00:00 2001 From: Esteban Cairol Date: Wed, 20 May 2026 18:05:24 -0600 Subject: [PATCH] Menus: Restore block_core_navigation_submenu_render_submenu_icon() as deprecated shim. The function was removed from src/wp-includes/blocks/navigation-submenu.php in [60810] (Gutenberg PR #74853, wordpress-develop PR #10865) without a _deprecated_function() notice, causing fatal errors on sites whose themes or plugins call it from a render_block_core/navigation-submenu filter. This restores the function as a thin wrapper that triggers _deprecated_function() and returns block_core_shared_navigation_render_submenu_icon(), the new shared helper that replaced it. Includes a phpunit test asserting the deprecation notice fires and the return value matches the new helper. Props ecairol. See https://core.trac.wordpress.org/ticket/65287. --- src/wp-includes/blocks/navigation-submenu.php | 13 ++++++++++++ .../navigationSubmenuRenderSubmenuIcon.php | 21 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 tests/phpunit/tests/blocks/navigationSubmenuRenderSubmenuIcon.php diff --git a/src/wp-includes/blocks/navigation-submenu.php b/src/wp-includes/blocks/navigation-submenu.php index 9138b5a5e08da..50586c42da806 100644 --- a/src/wp-includes/blocks/navigation-submenu.php +++ b/src/wp-includes/blocks/navigation-submenu.php @@ -55,6 +55,19 @@ function block_core_navigation_submenu_get_submenu_visibility( $context ) { require_once __DIR__ . '/navigation-link/shared/render-submenu-icon.php'; } +/** + * Renders the submenu icon SVG for the Navigation Submenu block. + * + * @since 5.9.0 + * @deprecated 7.0.0 Use block_core_shared_navigation_render_submenu_icon() instead. + * + * @return string SVG markup for the submenu icon. + */ +function block_core_navigation_submenu_render_submenu_icon() { + _deprecated_function( __FUNCTION__, '7.0.0', 'block_core_shared_navigation_render_submenu_icon()' ); + return block_core_shared_navigation_render_submenu_icon(); +} + /** * Build an array with CSS classes and inline styles defining the font sizes * which will be applied to the navigation markup in the front-end. diff --git a/tests/phpunit/tests/blocks/navigationSubmenuRenderSubmenuIcon.php b/tests/phpunit/tests/blocks/navigationSubmenuRenderSubmenuIcon.php new file mode 100644 index 0000000000000..986241ae753c7 --- /dev/null +++ b/tests/phpunit/tests/blocks/navigationSubmenuRenderSubmenuIcon.php @@ -0,0 +1,21 @@ +assertSame( + block_core_shared_navigation_render_submenu_icon(), + block_core_navigation_submenu_render_submenu_icon() + ); + } +}