[resolved] Catchable fatal error: Object of class WP_Error could not be converted to string (41 posts)

  1. salvation62
    Posted 4 years ago #

    Hi Guys

    I have a problem in my menus

    I am setting a blog using a custom theme, I have created 2 menus and added pages to them, everything worked fine, then I created some post and categories and now i want to add some categories in those menus but when I click the menu tab, down a list of available choices for the menu I get this
    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/greg2205/public_html/wp-includes/formatting.php on line 433

    I then check the formatting.php file on line 433 and I have this

    function wp_check_invalid_utf8( $string, $strip = false ) {
    	$string = (string) $string;
    	if ( 0 === strlen( $string ) ) {
    		return '';

    I don't know what to do really, anyone can help?

  2. esmi
    Forum Moderator
    Posted 4 years ago #

    Have you tried:

    - deactivating all plugins to see if this resolves the problem? If this works, re-activate the plugins one by one until you find the problematic plugin(s).

    - switching to the default theme to rule out any theme-specific problems?

  3. salvation62
    Posted 4 years ago #

    Hi, I have "found" the problem, thank you for your help anyway

  4. natty.chap
    Posted 4 years ago #

    whats the problem? can you let us know, and also the solution if you have. So that, it may help anybody else who is looking for same or similar help.


  5. guildrl
    Posted 4 years ago #


    I am wondering what you did to fix the problem? My site has just started doing this and I have changed nothing!

    Many thanks


  6. Dan L
    Posted 4 years ago #

    Salvation62: thanks so much for letting us know you fixed the problem, without letting on how you did it. Great effort.

  7. misthero
    Posted 4 years ago #

    I have the exact same error after deleting some custom taxonomies:

    Object of class WP_Error could not be converted to string in /home/greg2205/public_html/wp-includes/formatting.php on line 433

    anyone can post the solution please?

  8. Dan L
    Posted 4 years ago #

    I think that's the problem - something to do with deleting custom taxonomies when there are links in the Nav Menu which link to/are related to those now-missing taxonomies.

    I read a post somewhere describing the exact problem, and this guy had spent a considerable amount of time trying to fix the problem without success. In the end he had fixed it by resetting WP back to a clean state (I assume a default database), which will of course result in complete loss of site data.

    I would imagine there's a fix by delving into the database, but I've not explored this as the error I had was none-critical (on a localhost test site).

  9. misthero
    Posted 4 years ago #

    Shoudn't this be considered a bug someway? I mean WP should check if the taxonomy exist..

    I have tried recreating those exact taxonomies to remove those from the menu before deleting the taxonomies itself again.. but no luck.. I cannot access the menu anymore..

  10. Dan L
    Posted 4 years ago #

    Yes it is, and I believe it's already listed in Trac. I guess a combination of new features is to blame.

  11. guildrl
    Posted 4 years ago #

    As a temporary workaround until this is fixed, I am using WordPress menu creator plugin which seems to be working quite well.

  12. asafche
    Posted 4 years ago #

    guildrl, "As a temporary workaround" for what exactly? i didn't get it...

    I had the same error, and it caused by, as Dan L said, by changing my new taxonomies slugs, after i built the menus.

    the problem is that we still don't have "unregister_taxonomy" function available. it should be implemented in 3.1 as it says here

    in the meanwhile will have to wait or help the core developers, i guess...


  13. internalwealth
    Posted 4 years ago #

    Deleted the menu that I had created in another theme and voila!

    Kinda lame solution, but it worked.

  14. butters81
    Posted 4 years ago #

    I keep on getting this problem, or related problems. Basically it happens whenever I rename a custom taxonomy or custom posts. I'm using the Custom Post Type UI plugin, and I created a load of custom posts & taxonomies. I then decided to change the name of some of the taxonomies from sentence case to lowercase, and this is where it screwed various plugins (e.g. Query Multiple Taxonomies) and the wp-menu (Appearance / menu). When I changed the name of some of the taxonomies back, everything started working ok again (although had to delete the query multiple taxonomies widget, and add it back in again).

    Bottom line seems to be, once you've created your custom posts/taxonomies, don't alter them.

  15. luckysevens
    Posted 4 years ago #

    Deleted the menu that I had created in another theme and voila!

    Kinda lame solution, but it worked.

    yeah, seems only way for this problem

  16. Minkowski
    Posted 4 years ago #

    There is another solution, but it means tinkering with the database itself.

    In your WordPress database there is a table called wp_posts, if you view the content of the table by post_type you will see all of the nav_menu_items grouped together.

    You just need to delete the right row from this table. Discerning the right row isn't all that easy, however, but there are clues.

    The menu_order field should have a value, so if you knew where it was on a particular menu that will help. Also, the post_content field for any custom taxonomies will probably be blank, so that could be in indicator too. The other values in the post_content field should have the content of a particular post and these are probably not causing the problem.

    OK, there's a few probablys and by no means am I suggesting that this is foolproof, but it's better than deleting all of the database tables. It's worked for me without problems and maybe it is an interim solution until this bug is fixed.

  17. cshoffmann
    Posted 4 years ago #

    Would somebody please inform this amateur how I would delete the menu from a former theme? I would like to accomplish that solution. Thanks for help!

  18. manuki
    Posted 4 years ago #

    yes, i had the same issue when updating wp and the plugins.. something happened and thewn i couldnt access my MENU...(got this message-Catchable fatal error: Object of class WP_Error could not be converted to string in .../wp-includes/formatting.php on line 433) i tried to delete and copy the wp files, tried changing the formatting.php and nothing, the only way to fix it was to delete the wp installation and delete the DB... (luckily my host has these options easy to access)

    then reinstalled and voilá! it works again...
    i did make a copy of my plugins and themes folder, and will reupload... but the osts and data, its lost...

  19. asafche
    Posted 4 years ago #

    Thanks, @Minkowski !

    Very helpful tip...

    solved the problem with the database solution.
    not the most comfortable but did the work.


  20. PeterHatch
    Posted 4 years ago #

    OK get this!

    Had the very same problem

    I selected a redundant menu in the back end thinking I'd delete it (BIG MISTAKE) and got the error page and can't now view the menu admin page at all

    So remembering the menu I clicked on just before the error I deleted the two lines in the database

    Still get the error though

    Now it gets interesting...

    Log in under a different user admin and I can see menu admin no problem and yes the flawed menu tab has gone

    But go back to my original login and same problem


    Something is remembering which menu tab I was on and now takes me to a non existent tab which errors


    Clear that bit of memory that recalls which menu tabs selected


    Where are the menu settings for a user stored between sessions?


  21. perezdi
    Posted 4 years ago #

    I got the same stupid problem. I restored the php files but no sucess, I didn't get why because I restored the one it said where was the error.

    Maybe it's going be the easyest way to restore the theme to the standard and then edit everything again. I don't know if it's gonna work.

  22. Denny
    Posted 4 years ago #

    Hi All,

    I had the same problem and was able to fix it, so decided to share my experience.

    With my case, it turned out that there was a menu containing links to some custom taxonomies, that have been defined in a previous theme but did not exist in this one. So I had a taxonomy called "Portfolio Category" and links to several portfolio categories in a previously created menu. I was able to fix it by activating the previously installed theme and removing those links from the menu(removing the whole menu should also work).

    I hope this will be helpful.

  23. sevensoutbill
    Posted 4 years ago #

    Hey, I fixed this.

    Here's what I did. I went into the database, in the wp_term_taxonomy table, I found a record that showed "nav_menu" in the taxonomy column. I deleted that record and whammo, I got my WP menu functionality back. No need to reinstall.

    Hope this helps someone.


  24. vintagestephen
    Posted 4 years ago #

    I am having the exact same problem. I am not a programmer, so sevensoutbill how do you find that in the database and where do you remove it?

  25. sevensoutbill
    Posted 4 years ago #

    @vintagestephen I'm working in a dev environment right now. I have WP running on WAMP. So I accessed the database via, PHPmyAdmin. So how you access your db will depend on where your site is hosted. Hope this helps...

  26. cippoo
    Posted 4 years ago #

    I had the same error on both cippodesign.com and cippo.ro, so I did what @sevensoutbill said ( delete the nav_menu in the taxonomy column ) and didn't work so I went to wp_terms table and deleted the extra things ( terms that I didn't need anymore ) and it is working now.

    You have to go to wp_terms table in phpmyadmin and delete what you don't use anymore. It will work, no more 433 error :)

  27. Uma Sumeros
    Posted 4 years ago #


    I had this same problem and was almost at my wits end trying to find the cause and came up with zip. Finally I picked up the phone and called my web host who found your post and it worked like a charm!

    Thank you one thousand times over for sharing your experience.


  28. gcoghill
    Posted 4 years ago #

    I too encountered this error after renaming a custom taxonomy item.

    The solution by dennis_f worked for me — thanks!

  29. PeterHatch
    Posted 4 years ago #

    I used the @Minkowski method


    Deleting all the menu items in the database then finally deleting the empty menu from the back end

    I found it helpful to use the date modified to be able to identify all the items in a particular menu

    Haven't needed to delete taxonomies but I guess this would work too


  30. MojoDave
    Posted 3 years ago #

    @Minkowski — Thank You Thank You Thank You.


    Had to install PhpMYAdmin and had NO clue how to do that, but figured it out by myself (with a little prior experience). So here's what I did:

    I downloaded the Mac PhpMyAdmin version that you can find here:


    And then I downloaded the EZ7z application to uncompress it:


    I uncompressed the file and recompressed in .zip format. I uploaded this file on my public server and uncompressed it.

    I navigated to the PhpMyAdmin folder in my browser, which automatically opened index.php and launched PHPMyAdmin. I entered my cpanel access credentials.

    You just have to locate your WordPress DB installation and browse it to find the wp_posts and do just what Minkowski says. Works like a charm. Saved my day :)

Topic Closed

This topic has been closed to new replies.

About this Topic