Skip to content

Navigation: move the submenu chevron to the core icon registry #29

Open

Description

@Misplon

Replace the regex chevron swap with a registered icon once core routes the submenu chevron through the icon registry.

Low priority / backlog. Not a bug: the current approach works.

Current state

functions.php (origin_canvas_swap_nav_chevron(), around L481–514) swaps WordPress's default navigation submenu chevron for a Lucide chevron. It does this by running preg_replace on the block HTML: it matches core's inline <svg viewBox="0 0 12 12">… and puts an inline Lucide <svg> in its place. It is the theme's only hand-managed inline SVG. No .svg asset files exist; social-links and card-icon-text render through core blocks.

Opportunity

WP 7.1 (Registering and rendering SVG icons) adds a public icon API: wp_register_icon_collection(), wp_register_icon(), wp_get_icon(). The chevron swap could register the Lucide chevron through this API instead of regex-matching core's markup. That is cleaner and does not break if core changes its chevron SVG.

Why it is blocked

Checked against WordPress 7.1 (current stable) and Gutenberg trunk on 2026-09-12. Rechecked on 2026-10-20 against WordPress 7.1.3.

  • The Icon API is in 7.1 (wp-includes/icons.php: wp_register_icon_collection(), wp_register_icon(), wp_get_icon()). But the navigation submenu chevron does not go through it.
  • wp-includes/blocks/navigation-link/shared/render-submenu-icon.php returns a hardcoded 12×12 SVG string with no filter. navigation-submenu.php and navigation-link.php call it directly. Gutenberg trunk is the same.
  • So on 7.1 the only way to apply a registered icon is still a preg_replace on core's output, which the acceptance below rules out. It would also cost Requires at least: 7.1 for nothing the current swap does not already do.
  • The API is additive, not a deprecation. Nothing is broken and no migration is required. The theme currently targets 7.0.

The seam this issue needs is Gutenberg PR WordPress/gutenberg#82062 "Resolve SVG through Icon Registry" (opened 2026-08-26; still open with no milestone on 2026-10-20). It routes core block UI icons through the registry and exposes core/navigation-submenu as the identifier a theme overrides by registering a replacement SVG. The PHP render callbacks call wp_get_icon(), and the editor reads the registry through a useIcon() hook. So the override would reach the editor canvas too, which no render_block filter can do today.

Trigger

When #82062 ships in a WordPress release, pick this up. Until then the current swap stays.

Acceptance

  • Replace origin_canvas_swap_nav_chevron() with wp_register_icon( 'core/navigation-submenu', … ) carrying the Lucide chevron, in whatever override form the merged PR settles on.
  • Drop the preg_replace on block output.
  • Bump Requires at least in style.css and readme.txt to the release that ships #82062 (not 7.1, as first planned).
  • Verify that submenu chevrons still render on the front end and in the editor.

Activity

  1. added
    enhancement
    on Aug 8, 2026
  2. changed the title [-]Modernize nav chevron to the WP 7.1 SVG icon API (wp_register_icon)[/-] [+]Modernize the Nav Chevron to the WP 7.1 SVG Icon API[/+] on Aug 8, 2026
  3. Misplon commented on Sep 12, 2026

    @Misplon
    ContributorAuthor

    Blocked on core, not on us. Checked against WordPress 7.1 (current stable) and Gutenberg trunk on 2026-09-12.

    The Icon API is in 7.1 (wp-includes/icons.php: wp_register_icon_collection(), wp_register_icon(), wp_get_icon()), but the navigation submenu chevron is not routed through it. wp-includes/blocks/navigation-link/shared/render-submenu-icon.php returns the hardcoded 12×12 SVG string with no filter, and navigation-submenu.php and navigation-link.php call it directly. Gutenberg trunk is the same. So on 7.1 the only way to apply a registered icon is still a preg_replace on core's output — which this issue's acceptance rules out — and it would cost Requires at least: 7.1 for nothing the current swap does not already do.

    The seam this issue wants is Gutenberg PR WordPress/gutenberg#82062 "Resolve SVG through Icon Registry" (opened 2026-08-26, open): it routes core block UI icons through the registry and exposes core/navigation-submenu as the identifier a theme overrides by registering a replacement SVG, with the PHP render callbacks calling wp_get_icon() and the editor reading the registry through a useIcon() hook — so the override would reach the editor canvas too, which no render_block filter can do today.

    Trigger: when #82062 ships in a WordPress release, replace origin_canvas_swap_nav_chevron() with a wp_register_icon( 'core/navigation-submenu', … ) carrying the Lucide chevron (in whatever override form the merged PR settles on), drop the preg_replace, and bump Requires at least to that release. Until then the current swap stays.

  4. added
    blocked
    on Sep 12, 2026
  5. added
    priority-3
    on Oct 20, 2026
  6. changed the title [-]Modernize the Nav Chevron to the WP 7.1 SVG Icon API[/-] [+]Move the navigation submenu chevron to the core icon registry[/+] on Oct 20, 2026
  7. changed the title [-]Move the navigation submenu chevron to the core icon registry[/-] [+]Navigation: move the submenu chevron to the core icon registry[/+] on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    blockedenhancementpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions