[wp-trac] [WordPress Trac] #36212: Empty menu items are deleted without warning
WordPress Trac
noreply at wordpress.org
Thu Jun 4 14:08:46 UTC 2020
#36212: Empty menu items are deleted without warning
-------------------------------------+---------------------------------
Reporter: cameronjonesweb | Owner: audrasjb
Type: defect (bug) | Status: accepted
Priority: normal | Milestone: 5.5
Component: Menus | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses: ui, administration
-------------------------------------+---------------------------------
Changes (by samful):
* keywords: has-patch needs-refresh => has-patch needs-testing
Comment:
@audrasjb had the right advice here, so thanks for pointing me in the
right direction. This patch should solve the issue you were having.
In my testing, the patch seemed to work perfectly, but I also want to note
that after testing, I found that the theme "Twenty Nineteen" (My other
installed themes had no issues) has a CSS rule which hides any empty
{{{<a>}}} tags. So, to get round this I made a quick CSS rule to display
empty {{{<a>}}} elements again just for Twenty Nineteen. You may want to
include this in your custom css if you are using Twenty Nineteen, or edit
it to something similar if using another theme that hides empty {{{<a>}}}
elements:
{{{
.main-navigation .sub-menu > li > a:empty{
display: block;
}
}}}
I then went on to test what @cameronjonesweb was initially trying to do
(put an icon font or a symbol in the menu item):
{{{
.main-navigation .sub-menu > li > a:empty:after {
content: "\00a9";
}
}}}
I'll also attach screenshots of the admin view where I edited the menu
items and the front end where the empty items have the copyright symbol
{{{\00a9}}}. This is just an example of how it can be done using the
current patch and the CSS above on the "Twenty Nineteen" theme.
If someone else could give this patch a test too, that would be very
helpful :)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36212#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list