Skip to content

Menus: Deprecate block_core_navigation_submenu_render_submenu_icon() rather than removing it#11914

Closed
ecairol wants to merge 1 commit into
WordPress:trunkfrom
ecairol:fix/65287-deprecate-navigation-submenu-render-submenu-icon
Closed

Menus: Deprecate block_core_navigation_submenu_render_submenu_icon() rather than removing it#11914
ecairol wants to merge 1 commit into
WordPress:trunkfrom
ecairol:fix/65287-deprecate-navigation-submenu-render-submenu-icon

Conversation

@ecairol
Copy link
Copy Markdown

@ecairol ecairol commented May 21, 2026

Summary

block_core_navigation_submenu_render_submenu_icon() was removed from src/wp-includes/blocks/navigation-submenu.php in [60810] (Gutenberg PR #74853, synced via wordpress-develop PR #10865) as part of consolidating submenu icon rendering into the new shared helper block_core_shared_navigation_render_submenu_icon().

The removal landed without a _deprecated_function() notice or a backwards-compatible shim, so any theme or plugin that previously called the function — for example from a render_block_core/navigation-submenu filter to customise the dropdown chevron — now triggers a fatal PHP error on 7.0.

This PR restores the function as a thin deprecation shim:

  • Triggers _deprecated_function() so callers see actionable guidance to migrate to block_core_shared_navigation_render_submenu_icon().
  • Returns the output of the new helper, preserving the original rendered markup.
  • Includes a phpunit test asserting the deprecation notice fires and the return value matches the new helper.

Trac ticket: https://core.trac.wordpress.org/ticket/65287

Test plan

  • php -l src/wp-includes/blocks/navigation-submenu.php passes (verified locally).
  • phpunit --filter Tests_Blocks_NavigationSubmenuRenderSubmenuIcon passes.
  • On a site whose theme calls block_core_navigation_submenu_render_submenu_icon(), the page renders without a fatal and a deprecation notice is logged.
  • Existing Navigation Submenu rendering is unchanged (the shim is only used by external callers).

Props ecairol.

… deprecated shim.

The function was removed from src/wp-includes/blocks/navigation-submenu.php in
[60810] (Gutenberg PR #74853, wordpress-develop PR WordPress#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.
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props ecairol.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@ecairol
Copy link
Copy Markdown
Author

ecairol commented May 21, 2026

Closing — wrong repo for this fix.

CI surfaced the actual situation: src/wp-includes/blocks/navigation-submenu.php is now overlaid by the gutenberg:copy build step from the Gutenberg release, so a wordpress-develop-only change to that file fails git diff --exit-code. The canonical fix has to land in WordPress/gutenberg first and propagate via the Gutenberg → Core sync.

Re-opening as a Gutenberg PR against packages/block-library/src/navigation-submenu/index.php. Will link the new PR back to Trac #65287.

@ecairol ecairol closed this May 21, 2026
@ramonjd
Copy link
Copy Markdown
Member

ramonjd commented May 21, 2026

Re-opening as a Gutenberg PR against packages/block-library/src/navigation-submenu/index.php. Will link the new PR back to Trac #65287.

Good call. I guess the deprecation wrapper can be packages/block-library/src/navigation-link/shared/render-submenu-icon.php. Same fix as here.

Thank you for handling this!

@ramonjd
Copy link
Copy Markdown
Member

ramonjd commented May 21, 2026

I guess the deprecation wrapper can be packages/block-library/src/navigation-link/shared/render-submenu-icon.php.

I withdraw that. What you've done in WordPress/gutenberg#78484 LGTM. Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants