Skip Navigation

Resolved

Reported for: WPML Multilingual CMS 3.1.9.5

Resolved in: 3.1.9.7

Overview of the issue

  1. Go to the menu and create one in the default language.
  2. Try to create the menu in the second language.
  3. After saving you will get a 404 error.

Workaround

This problem has been solved in WPML 3.1.9.7

You should update to the recent WPML version to fix the problem

If you don’t want or can’t update WPML, please follow these directions:

  1. Download the updated version of iclNavMenu.class.php
  2. Use it as a replacement of sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php:
    Most likely this means you should use your FTP client and upload the file in sitepress-multilingual-cms/inc/wp-nav-menus: if you’re asked to overwrite the existing file, just do it.

In case of problems

In case you get any of these issues:

  • Fatal error: Call to undefined method SitePress::get_setting() in /wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php on line 121
  • PHP Fatal error: Call to undefined function wpml_prepare_in() in /wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php on line 548
  • A white/blank page

Take these steps:

  1. Go to “WPML” -> “Support”
  2. Click on “debug information“: you will see a gray text box, with a lot of information (it’s a json object)
  3. Copy the content of the textbox in a text file and name that file as you wish: better if you use the “json” extension, but this is not mandatory
  4. Create a new WordPress user with admin rights for me to debug the issue
  5. Install the free “Duplicator” plugin (here).
    You can use a different plugin, if you like, but the following directions are specific to Duplicator (though they can be easily adjusted for other plugins)
  6. Create a new package:
    1. Go to “Duplicator” -> “Packages”
    2. Click on “Create New”
    3. Proceed with the wizard, leaving all the default settings (if you wish, you can exclude some files you think are not needed, or that would make the package too big, like the files in “uploads” folder)
    4. Once the snapshot is ready, download both “installer” and the “package” files
  7. Create a folder and include the files at step 3 and 6.4 (that is, the text file with the debug information, the installer and the package).
  8. Zip that folder and upload it on Google Drive, Dropbox or a similar service (or upload the whole folder without zipping, and share it)
  9. Go to our support forum, and create a support ticket with the following title “Workaround issues – Saving menus in non default language leads to 404 error”: we will ask you to privately share the files you stored at step #8.

If you are using a too old version of WPML, this workaround may not work.

In these cases, you may get a white page, or this errors: PHP Fatal error:  Call to undefined function wpml_prepare_in()

To fix this specific error, please follow these steps:

  1. open

    'wp-content/plugins/sitepress-multilingual-cms/inc/functions.php'

    and search for 

    wpml_prepare_in
  2. If you can’t find it, add this at the bottom of the file:
    function wpml_prepare_in( $items, $format = '%s' ) {
     global $wpdb;
    
     $items    = (array) $items;
     $how_many = count( $items );
     if ( $how_many > 0 ) {
      $placeholders    = array_fill( 0, $how_many, $format );
      $prepared_format = implode( ",", $placeholders );
      $prepared_in     = $wpdb->prepare( $prepared_format, $items );
     } else {
      $prepared_in = "";
     }
    
     return $prepared_in;
    }

83 Responses to “Saving menus in non default language leads to 404 error”

  1. After doing this ‘fix’, my admin is going blank. Setting wp_debug to true, gives me the following error:

    Fatal error: Call to undefined method SitePress::get_setting() in /home/webroot/www2/……./wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php on line 121

    Please can you help me with a fix?? I’m using latest version of WPML, and WP 4.2

    • Bart, it looks like in some cases users like you are facing this problem.

      We are investigating and will post an update as soon as possible.

      Meanwhile I strongly advice you to post in our support forum, so to get the proper support.

      Thanks.

      • Hello, I have the blank menu page after the ‘fix’ problem too.
        Any news? Thanks

        • Giulia,

          We have updated our errata with some directions in case you face an issue.

          Please follow them, so we can assist you better.

          Thanks.

  2. I have this issue when I try and edit and save a menu – I wanted to implement this fix but can not see the directory – wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/

    I have /content and /plugins but the subdirectory /sitepress-multilingual-cms is not showing. Help!

    • Paul,

      It’s impossible for me to guess where the plugins are stored in your server, seems it looks like you have a custom setup.

      Please post in our support forum, so to get the proper support.

      Thanks.

  3. Worked for me too, but now the number in parentesis representig the total of menues in each languages disappeared

  4. Hi,
    trying to follow your instruction I had:
    PHP Fatal error: Call to undefined function wpml_prepare_in() in /nas/wp/www/cluster-40580/pagination/wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php on line 548

    anyway I think your doing an outstanding job! I love WPML!!! 🙂

    • Luca, can you please post a thread in the support forum?

      We can’t troubleshoot the issue from here.

      Thanks.

    • Laurent, can you please post a thread in the support forum?

      We can’t troubleshoot the issue from here.

      Thanks.

  5. Working for me too. I suppose the fix will be merged in the next wpml release.
    Thanks

  6. it works now. Sorry I had to clean cache after substituting your file.
    Thamk you

  7. after replacing the file in the error comes:
    Fatal error: Call to undefined function wpml_prepare_in() in /home/dmapar2015/public_html/wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php on line 548

    • Marco, please post a thread in the support forum?

      We can’t troubleshoot the issue from here.

      Thanks.

  8. My back-end also goes blank after replacing the PHP file. I cant go in my menu’s. Fix does not work. 4.2.1

    • Alexander, WPML works with WordPress 4.2.1. If your WP admin goes blank, there’s a good chance you’ve inserted a PHP error, causing a parsing error. I suggest that you enable error output. Then, check the error log and see what it says. It’s going to give the file name and line number causing this error.

      See here:
      https://wpml.org/documentation/support/debugging-wpml/

  9. I WPML resolved by updating to version suitable for wp 4.2, thanks for everything

  10. The supplied fix didn’t work for me (running WordPress 4.2.1), but installing the WPML 3.2 beta package solved the issue.

    For anyone who’s still having problems after applying this fix, you might try to install the RC2 beta in order to restore WP Nav functionality.