• Resolved Sebastian Pendino

    (@sebaros)


    Hi! I have this error when activating the plugin “WP Mega Menu Pro”. I’m working on a WP Multisite with MultilingualPress 2.

    https://codecanyon.net/item/wp-mega-menu-pro-responsive-mega-menu-plugin-for-wordpress/19190840

    Related issues on this forum:
    1) https://www.ads-software.com/support/topic/incompatibility-with-max-mega-menu/
    2) https://www.ads-software.com/support/topic/problem-with-grid-layout/

    Any suggestions? Thanks!

    Fatal error: Uncaught TypeError: Argument 1 passed to Mlp_Nav_Menu_Frontend::maybe_delete_obsolete_item() must be an instance of WP_Post, instance of stdClass given, called in /home/MySite/public_html/wp-content/plugins/multilingual-press/inc/nav-menu/Mlp_Nav_Menu_Frontend.php on line 53 and defined in /home/MySite/public_html/wp-content/plugins/multilingual-press/inc/nav-menu/Mlp_Nav_Menu_Frontend.php:74 Stack trace: #0 /home/MySite/public_html/wp-content/plugins/multilingual-press/inc/nav-menu/Mlp_Nav_Menu_Frontend.php(53): Mlp_Nav_Menu_Frontend->maybe_delete_obsolete_item(Object(stdClass)) #1 /home/MySite/public_html/wp-includes/class-wp-hook.php(288): Mlp_Nav_Menu_Frontend->filter_items(Array) #2 /home/MySite/public_html/wp-includes/plugin.php(208): WP_Hook->apply_filters(Array, Array) #3 /home/MySite/public_html/wp-includes/nav-menu-template.php(211): apply_filters(‘wp_nav_menu_obj…’, Array, Object(stdClass)) #4 /home/MySite/public_html/wp-content/themes/genesis/lib/functions/menu.php(104): wp_nav_men in /home/MySite/public_html/wp-content/plugins/multilingual-press/inc/nav-menu/Mlp_Nav_Menu_Frontend.php on line 74

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Sebastian Pendino

    (@sebaros)

    Well … I found this old post and a code that I have put as Must Use Plugin into /wp-content/. But I still have the same problem.

    https://www.ads-software.com/support/topic/multilingual-press-max-mega-menu-php-fatal-error/

    How could I modify this code to adapt it to solve my issue?
    Thank you!

    add_action( 'inpsyde_mlp_init', function ( Inpsyde_Property_List_Interface $data ) {
    
    	if ( is_admin() ) {
    		return;
    	}
    
    	remove_action( 'inpsyde_mlp_loaded', 'mlp_nav_menu_init' );
    
    	add_action( 'inpsyde_mlp_loaded', function () use ( $data ) {
    
    		$language_api = $data->get( 'language_api' );
    
    		( new Mlp_Nav_Menu_Controller(
    			$language_api,
    			$data->get( 'assets' )
    		) )->initialize();
    
    		add_action( 'template_redirect', function () use ( $language_api ) {
    
    			$frontend = new Mlp_Nav_Menu_Frontend( '_blog_id', $language_api );
    			add_filter( 'wp_nav_menu_objects', [ $frontend, 'filter_items' ], 9 ); // <-- HERE is your change. ;)
    		} );
    	} );
    } );
    Plugin Support dinamiko

    (@dinamiko)

    Hi Sebastian,

    As a quick fix try this, in src/inc/nav-menu/Mlp_Nav_Menu_Frontend.php line 74 replace this:

    public function maybe_delete_obsolete_item( WP_Post $item ) {
      $site_id = $this->get_site_id( $item );
      ...

    for this:

    public function maybe_delete_obsolete_item( $item ) {
      return false;
      $site_id = $this->get_site_id( $item );
      ...

    Try it and let us know.

    Thanks,
    Emili

    Thread Starter Sebastian Pendino

    (@sebaros)

    Thanks for your answer!

    Will this workaround continue to work when updating the plugin?

    Is there any way to solve the problem by using Hooks or Filters to not lose the fix with future plugin updates?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Incompatibility with WP Mega Menu Pro’ is closed to new replies.