Catchable fatal error: Object of class WP_Error could not be converted to string - Acme Themes

Best Premium and Free WordPress Themes Forums SuperMagPro Catchable fatal error: Object of class WP_Error could not be converted to string

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #6973
    James
    Participant

    On a post page, the breadcrumbs.php file fires the error:

    Catchable fatal error: Object of class WP_Error could not be converted to string in /home/c27colon/public_html/wp-content/themes/supermagpro/acmethemes/functions/breadcrumbs.php on line 78

    On line 76 is the issue, because that’s where the code calls “get_category_parents” which is what is throwing the error and can’t be output as a string on line 78.

    $cats = get_category_parents($cat, TRUE, ' ' . $delimiter . ' ');

    The issue seems to stem from a parent category no longer existing for the child category that the post is assigned to.

    They suggested fix is using something like this:

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

    Where the error is caught and handled before echoing the parent category.

    We’ve managed to fix many of the posts where this applies by simply reassigning the categories for the posts to newer categories but hope you take the time to catch the error and handle it for future releases of the theme.

    Thanks,
    Thom Prati
    Lead Designer,
    FingerLakes1.com, Inc.

    • This topic was modified 5 years, 4 months ago by James.
    • This topic was modified 5 years, 4 months ago by James.
    #6985
    acmesupports
    Moderator

    Thank you for your suggestion. We will resolve this issues on next updates.
    Thank You

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