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.

  1. Open wp-includes/category-template.php
  2. Search for “function get_category_link( $category_id ) {
  3. Now inside that function, search the following lines
    if ( is_wp_error( $category ) )
    return $category;
  4. Replace the above 2 lines with following code
    //if ( is_wp_error( $category ) )
    //return $category;

That should solve the problem. Enjoy WordPressing.

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!