I’m getting a similar error when I try to access posts:
Catchable fatal error: Object of class WP_Error could not be converted to string in /home/ryebrew/wedrinkyourbeer.com/wp-content/themes/Swagger-Theme/swagger/inc/single-normal.php on line 144
Although it’s not a functions.php problem, it seems similar to me since it started after I deleted some categories. The problem code is:
$top_cat = split(':',$cat_tree);
and it’s around
<?php // get parent category
if(get_post_type() == 'post') {
$category = get_the_category();
$cat_tree = get_category_parents($category[0]->term_id, FALSE, ':', TRUE);
$top_cat = split(':',$cat_tree);
$parentObj = get_category_by_slug($top_cat[0]);
$parent = $parentObj->name;
$cat_link = get_category_link($parentObj->term_id);
} else {
$parent = "";
$cat_link="";
Any help would be hugely appreciated.