Skip to content

Fix: Menu Item Without Label Being Removed#7699

Open
nirajgiriXD wants to merge 2 commits intoWordPress:trunkfrom
nirajgiriXD:fix/menu-item-without-label-being-removed
Open

Fix: Menu Item Without Label Being Removed#7699
nirajgiriXD wants to merge 2 commits intoWordPress:trunkfrom
nirajgiriXD:fix/menu-item-without-label-being-removed

Conversation

@nirajgiriXD
Copy link
Copy Markdown

Description

This PR addresses the issue where menu items without labels were being removed.

Changes Made

  • Remove check for empty labels for menu item
  • Add no-title class for empty label menu item

Why?

  • Menu items were being deleted silently, without prompting the user to confirm whether the item should be removed.
  • Users couldn't create a menu item with an empty label, which they might want to use for custom purposes—for example, to display an icon using the fa fa-envelope class without any label text.

Steps to Reproduce

  • Create a new menu.
  • Add two custom links (e.g., https://example.com/) with link text labeled "test1" and "test2," then add each to the menu.
  • Save the menu.
  • Assign this menu to a theme location that is visible on the site, then save your changes.
  • Visit the site to confirm that both menu items are displayed.
  • Return to the Edit Menus section, edit the "test2" menu item and remove the label and hit the save button.
  • The item will be removed.

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 1, 2024

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 nirajgirixd.

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

@github-actions
Copy link
Copy Markdown

github-actions bot commented Nov 1, 2024

Test using WordPress Playground

The changes in this pull request can previewed and tested using a WordPress Playground instance.

WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Some things to be aware of

  • The Plugin and Theme Directories cannot be accessed within Playground.
  • All changes will be lost when closing a tab with a Playground instance.
  • All changes will be lost when refreshing the page.
  • A fresh instance is created each time the link below is clicked.
  • Every time this pull request is updated, a new ZIP file containing all changes is created. If changes are not reflected in the Playground instance,
    it's possible that the most recent build failed, or has not completed. Check the list of workflow runs to be sure.

For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation.

Test this pull request with WordPress Playground.

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.

1 participant