Skip Navigation


Reported for: WPML Multilingual CMS 4.0.0

Resolved in: WPML Multilingual CMS 4.0.2

Overview of the issue

When upgrading WPML, you might encounter the following error:

Catchable fatal error: Method WPML_Admin_Menu_Item::__toString() must return a string value ...


This issue will be fixed in the next WPML release.

Until then, you can apply the following fix.

1. Edit the class-wpml-admin-menu-item.php file found in the ../wp-content/plugins/sitepress-multilingual-cms/classes/admin-menu/ folder.

2. Replace the code found in the function serialize() from this:

Replace this code
return json_encode( array(
'capability' => $this->get_capability(),
'function' => $this->get_function(),
'menu_slug' => $this->get_menu_slug(),
'menu_title' => $this->get_menu_title(),
'order' => $this->get_order(),
'page_title' => $this->get_page_title(),
'parent_slug' => $this->get_parent_slug(),
) );

To this:

With this code
$function = $this->get_function();
if ( is_callable( $function ) ) {
* "Hash" is for the hash table. That's not an actual hash of the callable, but it should
* be good enough for the scope of this function
$function = spl_object_hash( (object) $function );

return wp_json_encode( array(
'capability' => $this->get_capability(),
'function' => $function,
'menu_slug' => $this->get_menu_slug(),
'menu_title' => $this->get_menu_title(),
'order' => $this->get_order(),
'page_title' => $this->get_page_title(),
'parent_slug' => $this->get_parent_slug(),
), 0, 1 );

23 Responses to “Fatal error upgrading WPML -> Method WPML_Admin_Menu_Item::__toString() must return a string value”

        • You have to either use the hosting panel file manager or connect via ftp and rename the offending plugin folder.
          You can check also this awesome tutorial here: @

  1. Hi. I had the same problem with wp-admin access. I resolved it by renaming wpml-media plugin folder. I tryed to solve the issue using your advice to replace code
    Edit the class-wpml-admin-menu-item.php file found in the ../wp-content/plugins/sitepress-multilingual-cms/classes/admin-menu/ folder.
    , but I have no such folder and such file. Any ideas?
    How soon could you release a new update?

    Thank you

    • If you don’t have that folder, then yes – you are using old version and you should update.
      You can do this manually via FTP, or via your hosting file manager or even by removing the plugins and then manually uploading them in your dashboard in Plugins > Add New

  2. You wrote that it’s necessary to obtain a fresh version from our site in /account/downloads/ and try again. What about current settings? Will they be safe?

    Thank you

  3. Hi, George. In fact I did the following:

    1. Renamed media plugin folder and got an access to wp-admin. wpml media plugin was automatically deactivated
    2. Then I launched update of all plugins exept wpml media.
    3. Then I activated media plugin and got 2 or 3 informational messages one by one with suggestions to update media plugin database. The last one (Complete setup or something like that) didn’t finish quite normally. I got infinite process and finally I interupted it by refreshing the browser window. Finally I got a list of images and it looks like everything is all right now.

    I am a bit concerned because the version of downloadable plugins on is more fresh. For example my cms plugin version is 4.0.0 and on wpml it’s 4.0.2. or 4.0.1. (I don’t remember codes exactly).
    So what have I do no? Wait for next update? Or update plugins via ftp?

    Thank you!

    • Yes, we released a new version that fixes some bugs – WPML 4.0.1
      Updating is always recommended as we fixed some issues in that release, but remember to always have a backup – as a best practice.
      You can try the automatic update – it should work.

  4. Issue detected yesterday on version 4.0.0 and fixed today on version 4.0.1, but when are you going to fix this issue? In which version? I need to know to do the next update or not 😉

    Kind regards.

  5. Fatal error….I deactivated all WPLM Plugins… simply… it works … i’m waiting for a new correct update now. Kind regards Kurti.

  6. No puedo entrar al administrador de mi página. Error 500

    Esta página no funciona
    La página no puede procesar esta solicitud ahora.
    HTTP ERROR 500

  7. Hi there!
    I followed your advices.
    To access to my dashboard, I had to change the name “wpml-string-translatio”.
    but then, I saw I could upload its last version was available to updating.
    So I did it.
    Everything seams to be ok.
    However I now have 2 similar files “wpml-string-translatio” and “wpml-string-translation” in my hosting.
    Can I delete the first one?
    Or what should I do?

    Thanks for your help,
    Best regards,