PHP Catchable fatal error using get_category_parents
-
Using the theme with PHP5.3 and > sometimes you get the error:
PHP Catchable fatal error: Object of class WP_Error could not be converted to string in xxxxx\wp-content\themes\themolio\functions.php on line 365
This is because the call to get_category_parents should expect a text OR A WP ERROR object!
There are many calls in themolio of this function that assume the return be a text, so I solved modifying wordpress:
wp-includes\category-template.php – line 42:function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $visited = array() ) { $chain = ''; $parent = get_term( $id, 'category' ); if ( is_wp_error( $parent ) ) return ""; //if $parent ERROR!! PHP v5.4.7 generate a "PHP Catchable fatal error: Object of class WP_Error could not be converted to string" (....) }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘PHP Catchable fatal error using get_category_parents’ is closed to new replies.