When I upgraded to WordPress 2.7 I started getting the following error wherever I used the get_the_category() function in my WordPress themes.
Catchable fatal error: Object of class WP_Error could not be converted to string in /home/dcing/public_html/wp-content/themes/dcing/category.php on line 52
I thought I would be a common bug, and I can easily find a solution on Internet so I tried search. But I was not able to find a fix for that problem. So I self debugged the code and managed to sort out a solution. Here are the steps to fix the problem.
- Open wp-includes/category-template.php
- Search for “function get_category_link( $category_id ) {“
- Now inside that function, search the following lines
if ( is_wp_error( $category ) )
return $category; - Replace the above 2 lines with following code
//if ( is_wp_error( $category ) )
//return $category;
That should solve the problem. Enjoy WordPressing.
2 Comments