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

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 replies, has 2 voices.

Last updated by Caridad 6 years, 7 months ago.

Assigned support staff: Caridad.

Author
Posts
#59260

My permalink structure might be the cause - but basically i have a formidable form creating a new post ( custom post type contacts )
the permalink structure that the search query looks for is showing no post and giving an error Catchable fatal error: Object of class WP_Error could not be converted to string in formatting.php line 509 and yet i have been able to view the post and it is under a different directory than what the taxonomy name is - tried to click on view taxonomy inside taxonomy screen and even though i see when clicked it says there are no posts to display - so basically my post is posting in wrong location and thus not showing up under taxonomy page i.e., blog_name/taxonomy_name/post_name it is instead showing up under hidden link and the blog page is hidden link but nothing under /Eternitees/blog/contact_type/contractor/ which contractor is the taxonomy... Any clue?

#59604

Dear Nathan,

With WordPress 3.5.1, edit wp-includes/formatting.php and in line 509 add this:

var_dump($string);

This will show us the actual error message.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

#59846

string(17) "Dictionary lookup" string(6) "lookup" string(19) "Close all open tags" string(10) "close tags" string(22) "Toggle fullscreen mode" string(14) "text direction" string(28) "Toggle Editor Text Direction" string(3) "Add" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(9) "Dashboard" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(21) "Visit plugin homepage" string(21) "Visit author homepage" string(3) "all" string(3) "all" string(3) "all" string(3) "all" string(3) "all" string(3) "all" string(3) "all" string(117) "hidden link" string(132) "hidden link"
Skip to main content

string(9) "Dashboard" string(0) "" string(5) "Sites" string(5) "Users" string(6) "Themes" string(9) "Plugins 0" string(8) "Settings" string(7) "Updates" string(0) "" string(11) "Performance"

string(74) "hidden link" string(26) "Shopmybamaprints.com Sites" string(101) "hidden link"

#59848

this was what was shown at top of page after adding code to line 509

#59854

this was what was shown at top of page after adding code to line 509 - I wonder is this is a possible answer but I am unsure as to where to try code and test? sorry - thanks!
http://wordpress.org/support/topic/catchable-fatal-error-object-of-class-wp_error-could-not-be-converted-to-string-11
This happens i understand because of custom post types or custom category types and is likely because an instance of a category ID is empty.

I found changing:

echo get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');

to

echo is_wp_error( $cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '') ) ? '' : $cat_parents;

fixed all my issues with the "Catchable fatal error: Object of class WP_Error could not be converted to string"

#60060

Dear Nathan,

That could resolve your problem but it would nice to find out why the error is displayed before discarding. Can you try adding this line before your code?

var_dump($cat);
echo is_wp_error( $cat_parents = get_category_parents($cat, TRUE, '' . $delimiter . '') ) ? '' : $cat_parents;

We can see the value of the $cat variable and figure out why its failing.

Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Regards,
Caridad

The topic ‘[Closed] Catchable fatal error: Object of class WP_Error could not be converted to string’ is closed to new replies.