Skip to content

Instantly share code, notes, and snippets.

@helgatheviking
Last active September 3, 2025 21:07
Show Gist options
  • Select an option

  • Save helgatheviking/d00f9c033a4b0aab0f69cf50d7dcd89c to your computer and use it in GitHub Desktop.

Select an option

Save helgatheviking/d00f9c033a4b0aab0f69cf50d7dcd89c to your computer and use it in GitHub Desktop.
Give Nav Menu Roles priority over any competing Walkers
<?php
/**
* Plugin Name: Nav Menu Roles Toggle
* Plugin URI: https://gist.github.com/helgatheviking/d00f9c033a4b0aab0f69cf50d7dcd89c
* Description: Disable any competing/incompatible Walkers
* Version: 0.3.0
* Author: helgatheviking
* Author URI: http://kathyisawesome.com
*/
remove_all_filters( 'wp_edit_nav_menu_walker' );
@funnychord
Copy link

Thank you for this!

@widmankarlsson
Copy link

Thank you! This solved my problems with our complex menu! :)

@mikewing94
Copy link

Thank you! this is great for using with the LMS theme, this has been an issue for a while conflicting with this theme!

@tara2
Copy link

tara2 commented Sep 20, 2019

Thank you so much for this! :)
...and for anyone who's not sure how to use this plugin (like me!) ...if you download to your computer using the top-right 'Download Zip' button on this page, then change the name of the zip file to something like 'Nav Menu Rules Toggle' ...and just upload it to your plugins page like you usually do. :)

@RevealMarketing
Copy link

I tried adding the code as a plugin. I did not fix the problem.

@helgatheviking
Copy link
Author

helgatheviking commented Sep 3, 2025

@RevealMarketing looking at the snippet and I'm not sure where $version is even defined. I'll make a little tweak that might help.

Nav menu roles hasn't used a custom walker in 5 years. at this point, any theme that still is overriding the walker via wp_edit_nav_menu_walker and not including the relevant core hook wp_nav_menu_item_custom_fields is doing it wrong and needs to update.

I will say that the full site editor experience is not supported as the UI for that is too restrictive, so this toggle only has any input on the admin menus page.

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