WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Catchable fatal error: Object of class WP_Error could not be converted to string

[Resolved] Catchable fatal error: Object of class WP_Error could not be converted to string

  • 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?

Viewing 15 replies - 1 through 15 (of 40 total)
  • esmi

    @esmi

    Forum Moderator

    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?

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

    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.

    Thanks.

    guildrl

    @guildrl

    Hello

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

    Many thanks

    Adrian

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

    misthero

    @misthero

    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?

    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).

    misthero

    @misthero

    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..

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

    guildrl

    @guildrl

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

    asafche

    @asafche

    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…

    Cheers.

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

    Kinda lame solution, but it worked.

    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.

    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

    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.

Viewing 15 replies - 1 through 15 (of 40 total)
  • The topic ‘[Resolved] Catchable fatal error: Object of class WP_Error could not be converted to string’ is closed to new replies.