To be very honest, I had never found a match for AdSense Injection, the best WordPress ad insertion plugin that comes with the highest level of flexibility. I have been using this plugin since 5 years and I did never look anywhere else. This free plugin not only lets us add AdSense (or any other HTML/Javascript code) inside post (below post title, post-middle and post-bottom) and many other locations but also allows conditionally display ads on different categories and tags. If you are running a multi-niche website, you may want to disable ads for certain categories and tags. Ad Injection does this job very nicely.

Some striking features of Ad Injection that makes it perfect

  • Show ads below title, between content and after content
  • Besides sidebar and footer, insert ads anywhere in your site using php template tag
  • Show/hide ads based on post length
  • Show/hide ads based on post category, tags
  • Show/hide ads according to visitor IP
  • Show ads only to search engine traffic
  • Ad rotation system

In a nutshell, I love Ad Injection. Everything was going great until I updated WordPress to version 4.7. Though Ad Injection is displaying ads properly, but it starts bothering me with PHP errors at the bottom of my website.

Warning: Illegal string offset ‘taxonomy’ in /home/wp_yfwtdd/inrealsense.com/wp-includes/taxonomy.php on line 1874

Warning: Illegal string offset ‘object_ids’ in /home/wp_yfwtdd/inrealsense.com/wp-includes/taxonomy.php on line 1875

I try disabling plugins one by one and found that Ad Injection was causing this issue. I looked for a solution in plugin support section but didn’t find any solution. But soon I realize that the error was most likely due to some missing data in plugin dashboard and I discovered it.

Actually I had footer ad enabled but I didn’t define the footer ad. This way footer ad data was missing and causing the PHP error. I disabled footer ad and the problem got fixed immediately.

How to fix the issue step by step

  • Go to WordPress dashboard > Settings > Ad Injection
  • Here see the Ad control panel and check all the locations that are “not in use” or where you don’t want to display ads (specially footer)

  • After that, save the settings. I hope this will fix this weird issue that is getting indexed by search engines.

Additionally this issue may happen due to any other plugin with some missing data or invalid data. So if you are getting this issue because of any other plugin, check the data submitted through this plugin.