WordPress 3.7 Upgrade Error: Call to a member function reset_postdata() on a non-object

Screen Shot 2013-10-25 at 11.43.20 AMI tried to upgrade my WordPress site this morning and got this error once the upgrade was finished: Call to a member function reset_postdata() on a non-object

Since I wasn’t looking forward to finding my latest backup and restoring my old version, and since I knew I would still have the problem even after I restored my old WordPress version, I set out to find the problem with my excellent debugging skills. 😉

I always start with plugins since they are often the culprit and they are easier to debug than themes. I started deleting plugins that I didn’t really want or need hoping that they would be the culprit and I could just get rid of them and get my site back to good. Nope. That didn’t work. Still had the problem after deleting all the plugins I didn’t really want.

Then I moved the plugin that I had created outside the plugin folder to see if that fixed the problem. Bam! My site was back up and running. But, I really want MY plugin to work and now I’m really curious what I’ve done wrong.

I move my plugin back into the plugin folder and look through the code to see if I can figure out what might be causing the problem. Since I know the error is occurring on this line in the wp-includes/query.php file:


I reason that my problem might be with one of the $wp_query calls I’m using in my code. My eyes immediately went to the wp_reset_query() line I had in my file. I commented out this line and Boom! my site is back up and running. Does my code need this line? I hope not because apparently this line doesn’t work in 3.7 OR I had the line in the wrong place in my code initially. I probably didn’t need it. It’s a plugin I created a while ago and I probably copied some of that code from another site. I’m sure I didn’t really understand what that line was doing.

I’ll give my site a thorough testing to make sure I don’t need that line of code. If I find that I do need it, it will make for another post. Until then, my site is working and I’m happy.

3 thoughts on “WordPress 3.7 Upgrade Error: Call to a member function reset_postdata() on a non-object”

Leave a Comment

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

Scroll to Top