helgatheviking / Nav-Menu-Roles

Display / Hide wp_nav_menu() items by role
65 stars 32 forks source link

NMR classes get appended to menu item classes field repeatedly on every menu save #38

Closed lkraav closed 4 years ago

lkraav commented 4 years ago

Something is wrong with https://github.com/helgatheviking/Nav-Menu-Roles/commit/e11845d2aeb7b065f201f2ca34eae8b493d4f453 logic.

I'm seeing 2 instances of nmr-logged-in and similar appended to my respectively configured menu item on every save. Some menu items have 50 copies of an nmr class.

@helgatheviking any instinctive idea what this might be about, or should I whip out the debugger?

helgatheviking commented 4 years ago

That's weird. I can't think of anything off the top of my head so any debugging you can do will be a big help. I also can't reproduce this as here are the classes showing for a logged in item in the Twenty Nineteen theme:

nmr-logged-in menu-item menu-item-type-post_type menu-item-object-page menu-item-550

Do you still have the issue with a default theme?

helgatheviking commented 4 years ago

@lkraav someone reported this again and it finally clicked that you meant the Admin! sorry about that. but it should be fixed now and the custom classes are only inserted on the front-end. When you delete the existing classes, they should stay gone now.

lkraav commented 4 years ago

Ouch, talk about a crappy opening statement by yours truly. Somehow I failed to express admin vs frontend, what a fail :persevere:

helgatheviking commented 4 years ago

ah well. i should've thought of it. but i looked on the frontend and could not see what you were talking about. ah well. is the update solving this for you?