Catchable fatal error: Object of class WP_Error could not be converted to string in

Out of Blue I got this error today when I clicked on an image on my blog.

WordPress Error: Catchable fatal error Object of class WP_Error could not be converted to string in
WordPress Error: Catchable fatal error Object of class WP_Error could not be converted to string in

Catchable fatal error: Object of class WP_Error could not be converted to string in /public_html/wp-content/themes/ajaykumarsingh/includes/theme-functions.php on line 271

I’ve never seen this kind of error before and it never happened on any of my blogs before.

The weird thing is that I’m using exactly same theme on Laptop Reviews blog and there is no error there. I haven’t modified any theme functions in the theme at all.

Did search for “WordPress Error: Catchable fatal error Object of class WP_Error could not be converted to string in” but couldn’t find a clear solution. It seems this error is related with some menu or menu plugins. I’m not using any menu plugins.

The theme I’m using has it’s own inbuilt menu system so probably that might be causing this problem?

Here are some of the steps I followed to solve this issue

1) theme-functions.php  line 271

I checked the code at line no. 271 and it is out of my reach to find out what could be the error here.

2) Menu

I remember fiddling with the menus as I’ve to customize to add a second level menu as you can see in the header. So the nest step was to remove the secondary level menu. It didn’t fix the problem.

Then I deleted all the menu from the Custom Navigation in the theme’s option but it still didn’t solve the problem.

3) Image linked to attachment

I normally link images to attachment url and not to the image itself. So I decided to do a quick check to revert back one image to link to image itself and not to the attachment url and bingo the error was gone.

So it seems the error is triggered from the attachment url or attachment theme.

4) Switched Back to Default Theme

Another quick test I did was to switch the theme to Twenty Eleven, and when I clicked on the image I didn’t see any error.

So I’ve narrowed down the problem to attachment theme file.

5) Finding the problem in Theme files

I don’t have any attachment template file so the default file used for attachment urls would be signle.php which is next template file in the WordPress template hierarchy. However I haven’t changed anything in the single.php file so I don’t see any problem in single.php file.#

6) Removing Custom Navigation from the Theme

Next try is to complete remove the custom navigation from the theme and also remove/comment out all the function this navigation system uses.

Chances are that this will solve the problem.

If this doesn’t solve the problem then the last resort is either do something in database.

The Solution

The problem seems to be with the theme’s custom breadcrumb. I unchecked the custom breadcrumb option and now error is gone.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *