A-2 Aishwarya Appt. Satellite Ahmedabad
+91 9825751564
+1 6502657266

WPML Plugin Shows 404 error with WordPress version Upgrade

If you are truly looking forward to developing and running a multilingual website, you must go ahead with one of the best WordPress plugin called WPML. It allows you to build phenomenal WordPress websites which can support multiple languages, and that takes your business a step further when it comes to gaining popularity among a wide range of people across the world.
However, the one thing that creates a slight discomfort to users is that whenever they update WordPress version, the old version of WPML started showing 404 errors in Admin when you save menu of WordPress in secondary language.

How to solved 404 errors with old version WPML (3.1.9.7), when we update WordPress Version:

  • Can you update the old version of WPML with latest WPML version to fix this problem
  • You need to do some coding level changes, if don’t want to upgrade to the new version:

Follow given steps to solve 404 errors in second language, with WPML Old Version

  • Download the updated version of  iclNavMenu.class.php
  • You need to replace in WPML plugin, You can find at below path. “sitepress-multilingual-cms/inc/wp-nav-menus/iclNavMenu.class.php”.
    If you have FTP clients, then upload the file at below path.
    ”sitepress-multilingual-cms/inc/wp-nav-menus” : If you’re asked to overwrite the existing file, just do it.

In case you get any of these issues:

  • 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

If anyone is using a very old version of WPML Plugin, sometime you haven’t found wpml_prepare_in() function in functions.php file of the plugin.

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

Follow below steps to add some code in that file and then our issue will be resolved.

  1. Open:’wp-content/plugins/sitepress-multilingual-cms/inc/functions.php’
    Search for: “wpml_prepare_in”
  2. If you can’t find it, add below code to 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;
}

Enjoy.