I'm working on a WordPress site with Chinese language which use WP Bakery plugin.

I added woocommerce product category short code on home page to show some products from a category

It works on a all categories except one category.

when i add that category to show product it shows this error and products not showing

<b>Recoverable fatal error</b>:  Object of class WP_Error could not be converted to string in 
<b>/public_html/wp-includes/formatting.php</b> on line <b>3797</b><br />

enter image description here Anyone know a solution or reason for this error please.

Thank You

  • 1
    The error is likely because you echo an instance of the WP_Error class. But regarding how to fix it, you need to locate the code which triggered the error. And you should post it if you can't fix the problem.. – Sally CJ May 3 at 5:59
  • @SallyCJ the function after <a href=" seems default woocommerce function to get an product url, i wonder why it works for some products and for some products shows this error, the url have English letters , i'll try to add that locations code here, Thanks – Suneth Kalhara May 3 at 6:21
  • 1
    I'm guessing the function being used there is the get_term_link function which returns a WP_Error instance when the term does not exist. So make sure you use the correct term name, slug, etc. But I could be wrong, since I don't know the code. – Sally CJ May 3 at 7:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.