i have this error (Catchable fatal error: Object of class WP_Error could not be converted to string in collapscatlist.php on line 61) if i chosen custom taxonomy type and “”links to category archive”. Can you give a hand? Thanks a lot.
I solved the problem.
Open collapscatlist.php and move to line 61.
Old
$link = "<a href='" . get_term_link($the_cat, $cat->taxonomy) . "' ";
Change it to:
$link = "<a href='" . get_term_link(intval($the_cat), $cat->taxonomy) . "' ";
That is it!
========
P.S.
I have been very frustrated by people who find solutions to their problems and don’t bother at all to inform others of their solutions. If this problem bothered you for long, please try to post this solution to at least one more place where users can find answers.
===========
There is something too that i found about catchable errors: They are catchable. Therefore a far more robust solution to the problem above is to replace the old code in line 61, i.e:
Old
$link = "<a href='" . get_term_link($the_cat, $cat->taxonomy) . "' ";
with this:
/*
Incase of an insolvable link error, use the get_category_link() function which does NOT raise an error upon failure
*/
if (is_wp_error(get_term_link(intval($the_cat), $cat->taxonomy)))
{
$link = "<a href='" . get_category_link($the_cat) . "' ";
}
else
{
$link = "<a href='" . get_term_link(intval($the_cat), $cat->taxonomy) . "' ";
}
awakanto, you are the best!!!
That solved my problem!
Thank you very much.