Support » Plugin: Popup Maker - Popup Forms, Opt-ins & More » Overrides other menu functions

  • Resolved refica



    After updating from 1.5.4 to 1.5.5 and 1.5.6 the new “Trigger a Popup” function under “appearance -> Menus” courses problems. It is simply overriding other functions build in by our theme. (We use Uncode from undsgn). Now we are missing checkboxes like “Megamenu” and “Button Style”. And because of that our menu does not work properly.

    Please see images for better understanding:

    Before (ver. 1.5.4 and below) screenshot:!AsAN81h30kdGhJheDy3T98mUiyOMlw

    After (Ver. 1.5.4 and above) screenshot:!AsAN81h30kdGhJhdYkiMtzfBUjXiyQ

    As a temporary solution is it safe to Roll-back the plugin to ver. 1.5.4?

    Thank you!

    Kind regards
    René Andersen

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author danieliser


    @refica – Hmm, sorry to hear that. I will have to add an option to disable the menu editor in these cases. The issue is actually in your theme, as well as in WordPress core. You can revert back to 1.4.21 since this feature was built into v1.5.0. The rest I am adding here for you and others to send to their theme authors to make this much better for everyone. It describes the entire issue, as well as a permanent & stable solution used on over 300k websites between Popup Maker, Nav Menu Roles, If Menus and various themes.

    Look for the new option in v1.5.7.

    Going to mark this resolved as I know the issue, am adding an option to disable on our end and detailed the solution for others & theme developers below.

    Hope that helps. Please take a moment to click that it Works and to rate and review the plugin or support.

    Basically in short:

    WordPress core doesn’t include any way to add custom fields to the menu editor. They allow overriding a PHP class that is used to create the menu editor though, but only one plugin/theme can do this at a time.

    The most common solution is to simply copy the core WP class and add your fields where they would go. This means that when another plugin tries to add fields by replacing the class WP uses the first no longer appears.

    Our solution was created a few years back and will work with dozens of plugins modifying the menu editor. It is currently used in ~30 plugins on the repo and dozens of themes, as well as a lot of premium ones on codecanyon for instance. It only makes one change to the class used to override the core one, it adds a hook/action so that we can add fields via add_action, and others can do the same.

    We recommend trying to reach out to your theme author and getting them to update their code, which is a much better solution as it will then allow users of your theme to also use other plugins such as User Menus, Nav Menu Roles, If Menu etc.

    It has also been tested all the way back to WordPress v3.0 and works with any version between there due to lots of testing for maximum backward compatibility.

    The solution if you want to point them here for reference is simple. I will put this here so we can also point other theme authors here over the coming months.

    1. Replace your current wp_edit_nav_menu_walker filter with this one. Correct paths for your needs.

    function custom_nav_menu_walker( $walker ) {
    	global $wp_version;
            // Here to prevent false warnings from If Menu and plugins that notify you of nav menu walker replacement.
    	if ( doing_filter( 'plugins_loaded' ) ) {
    		return $walker;
            // Return early if another plugin/theme is using the same custom fields walker we are. We are already compatible.
    	if ( $walker == 'Walker_Nav_Menu_Edit_Custom_Fields' ) {
    		return $walker;
            // Load the proper walker class based on current WP version.
    	if ( ! class_exists( 'Walker_Nav_Menu_Edit_Custom_Fields' ) ) {
    		if ( version_compare( $wp_version, '3.6', '>=' ) ) {
    			require_once 'menus/class-nav-menu-edit-custom-fields.php';
    		} else {
    			require_once menus/class-nav-menu-edit-custom-fields-deprecated.php';
    	return 'Walker_Nav_Menu_Edit_Custom_Fields';

    2. Include the following files/classes to your plugin into the paths from the function above. Do no rename the classes, there are ample checks to prevent them from being reloaded if they exist already. Keeping these names ensures long term compatibility for all plugins using them.

    3. Move your custom nav menu editor fields (without modification) to a new function hooked like so.

    add_action( 'wp_nav_menu_item_custom_fields', '_my_custom_nav_menu_fields', 10, 4 );
    function _my_custom_nav_menu_fields( $item_id, $item, $depth, $args ) {
    	wp_nonce_field( 'pum-menu-editor-nonce', 'pum-menu-editor-nonce' ); ?>
    	<p class="field-popup_id  description  description-wide">
    		<label for="edit-menu-item-popup_id-<?php echo $item->ID; ?>">
    			<?php _e( 'Trigger a Popup', 'popup-maker' ); ?><br />
    			<select name="menu-item-pum[<?php echo $item->ID; ?>][popup_id]" id="edit-menu-item-popup_id-<?php echo $item->ID; ?>" class="widefat  edit-menu-item-popup_id">
    				<option value=""></option>
    				<?php foreach ( PUM_Modules_Menu::popup_list() as $option => $label ) : ?>
    					<option value="<?php echo $option; ?>" <?php selected( $option, $item->popup_id ); ?>>
    						<?php echo esc_html( $label ); ?>
    				<?php endforeach; ?>
    			<span class="description"><?php _e( 'Choose a popup to trigger when this item is clicked.', 'popup-maker' ); ?></span>

    4. For bonus if you want to include option to show/hide specific fields the same way WP core does in the nav editor.

    // Priority of 11 is important, WP overwrites anything before that.
    add_filter( 'manage_nav-menus_columns', '_my_nav_menu_columns', 11 );
    function _my_nav_menu_columns( $columns = array() ) {
    	$columns['popup_id'] = __( 'Popup', 'popup-maker' );
    	return $columns;



    Same problem, different theme.
    (I found the disable option in the settings of the popup plugin, it helps.)

    It should be in reversed default disabled. Totally, Wasted my few hours to find out this thread and actually the issue. Things should easier than overriding a complete walker.

    +1, Same problem with Mega Main Menu. Completely disabled the menu functionality.

    • This reply was modified 2 years, 4 months ago by LogixTree. Reason: typo

    Hi I am having similar problem where the latest update is not allowing me to save the “Trigger a Popup” in the menu list. In the drop down the popup is present but once clicked on save it removes it. Please advise

    Same song, second verse. Cannot save “Trigger Popup” on menus. I clicked the box on the Misc Settings tab that says “Disable Popups Menu Editor” and manually linked to the pop-up (i.e. #popmake-XXX).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Overrides other menu functions’ is closed to new replies.