• Resolved conticreative1

    (@conticreative1)


    Yesterday I was updating a couple of plugins on a wordpress 4.2.2 website I just inherited when suddenly both in the front end and the admin area I received this error:

    Fatal error: Call to a member function get() on a non-object in /home/accountName/public_html/wp-includes/query.php on line 28

    I immediately started researching what could have happened. I inherited the site about a week ago and I have been updating the various plugins that are installed without much trouble. At the time of the error, I was trying to update the Yoast SEO plugin and it seemed to be taking more time than usual.

    After conducting some research on the error online I tried to fix the site as suggested but nothing seemed to work. Finally I opened the file

    query.php

    and I simply commented pout this line:

    return $wp_query->get( $var, $default );

    Magically, the site returned to working conditions and it has been working since.

    However, I am not really sure why and I suppose that line of code is needed for wordpress to work properly.

    I do have a backup (both files and database_) from a few days ago and the only change I really made was in one of the page.

    Also, the backup plugin installed in the site apparently would let me restore just the plugin directory if I wanted to (it seems to allow partial restores and in fact I wasn’t able to find a complete backup).

    I’d like to know how to proceed. Should I restore the plugin directory since it looked like the culprit for the error?
    SHould I try to restore the entire site even though that backup plugin seem to be a bit disjointed?

    I’d really appreciate some help from somebody with a bit more experience on the matter. Thank you.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Moderator t-p

    (@t-p)

    However, I am not really sure why and I suppose that line of code is needed for wordpress to work properly.

    Golden rule: do not mess with core files.

    Why?
    – Your mods will be overwritten when you next update the WP.
    – Side-effects may include security issues, and proper functioning of the plugins and theme.

    Instead, try:
    – deactivating ALL (yes all) plugins temporarily to see if this resolves the problem (plugin functions can interfere). If this works, re-activate them individually (one-by-one) to find the problematic plugin(s).
    – If you can’t get into your admin dashboard, try resetting the plugins folder by FTP. If that resolves the issue, reactivate each one individually until you find the cause. Sometimes, an apparently inactive plugin can still cause problems. Also remember to deactivate any plugins in the mu-plugins folder (if you have created such folder). The easiest way is to rename that folder to mu-plugins-old.
    – switching to the unedited default Twenty Fifteen theme for a moment using the WP dashboard to rule out any theme-specific issue (theme functions can interfere like plugins). If you don’t have access to your admin area, use FTP , or your web-host’s cPanel or whatever file management application your host provides. Navigate to /wp-content/themes/ and switch to the default theme by renaming your current theme’s folder by adding “-old” to the end of the folder name. Alternately, you can remove other themes except the default theme. That will force your site to use it.
    – If all the above steps do not resolve the issue, then try MANUAL updating. Download a fresh copy of the WordPress .zip file to your computer, unzip it, and use that to copy up all files and folders EXCEPT the wp-config.php file and the /wp-content/ directory. You may need to delete the old copies of files & folder on your server before uploading the new ones. Read the Manual Update directions first.

    Thread Starter conticreative1

    (@conticreative1)

    These are all good suggestions, thank you and thank you for responding so quickly.

    I should specify that while I don’t have a lot of experience with wordpress, I do know Joomla very well and a lot of things are similar, such as not messing with core files.

    Your suggestions regarding the plugins was something I was already planning on, but since I have never done it before and the site is live, I wanted to make sure I had a solid plan in place not to make things worse.
    Fortunately, I have access to cpanel directly, in fact, the site is now on a WHM server I manage, so I have as much access as I want.

    I was a bit taken aback from the way Updraft Plus, the backup plugin works, I am used to making full site backups and I was planning to restore a clone of the site in a subdirectory to troubleshoot this issue, but doesn’t look like there is a complete site backup for me to restore. I’ll have to read the documentation and figure it out.

    There is definitely something wrong with the plugins, because I keep updating the same plugins only to find the notice that they need to be updated again shortly after. Right now for instance, it show a single plugin in need of an update, yet when I get in the plugin screen it tells me 4 of them, the same 4, need updating. Unless they are releasing updates every 5 minutes, something is wrong.

    Anyway, you put me in the right direction. Thank you very much.

    Moderator t-p

    (@t-p)

    because I keep updating the same plugins only to find the notice that they need to be updated again shortly after.

    Have you tried updating them manually?

    Thread Starter conticreative1

    (@conticreative1)

    Not yet, but I was planning to do it. I really would prefer to set up a staging site before I do anything more. Thank you for the tip though. It cannot hurt to do that first.

    Just go same error on a site, but where no updates had been run at all and its protected by a cloud proxy. SO how come that? Checking with Hosts and Sucuri. But odd error given no one has changed anything on the site? We are investigating further. No plugins changed or updated so odd out of nowhere. Have backups etc. But difficult to trap whats causing it. Will update when we find out.

    Thread Starter conticreative1

    (@conticreative1)

    Here is something really strange about this error. As you can read in my OP, I commented out a line of code on my query.php page mentioned oin the error. That fixed the site.

    I posted here because I figured I couldn’t just comment code out of the core files and hope for the best.

    As I got valuable advice here, I formulated a couple of good plans, so I went back to query.php. line # 28 to “un-comment” line 28 to see if the site would break again. I discovered then that line 28 was no longer commented out. Also, the site was working just fine with that line in its full glory.

    I have no ideas what happened. I know I did not make the change and that means that WP did it on its own.

    The site is working fine, the core files are OK and today WP got updated to 4.2.3 (if I remember correctly).

    So this error popped out of the blue, god fixed by commenting out a line in query.php and then reversed itself all by its own self.

    Very strange.

    Moderator t-p

    (@t-p)

    Is the issue resolved now or not?

    Thread Starter conticreative1

    (@conticreative1)

    It resolved itself, as I explained in my last post. The site is working fine, the line of code I had commented out is no longer commented out, but the error is not showing up anymore.

    I have done nothing to make that happen so it is solved, but certainly not to a level where I can say what caused it and how it was fixed.

    That’s why I am not going to mark it solved for now. SOmeone with the same issue may thing I am using magic.
    Bizarre.

    Thank you for checking.

    Moderator t-p

    (@t-p)

    Glad to know it ??

    Hello , i have my own WordPress site and one day when I tried to add new post I couldn’t sign in and it said this

    Fatal error:

    Call to a member function get() on a non-object in /home3/accountName/public_html/wp-includes/query.php on line 28

    Help please!!

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Fatal error in query.php line 28’ is closed to new replies.