Home › Forums › Calendar Products › Events Calendar PRO › Fatal error: Call to a member function is_main_query() on a non-object
- This topic has 21 replies, 2 voices, and was last updated 8 years, 1 month ago by
dialogue99.
-
AuthorPosts
-
February 15, 2018 at 11:19 am #1454566
dialogue99
Participanthi there, our test site uses your events pro and community events plugins. However when they are active they cause the fatal error you see in the screenshot attached.
It is very odd as the page you see is the user dashboard for the directory plugin we are using. There are no calendars or any other of your widget to appearing on that page. Yet the error is clearly caused by one of your plugins.
Can you please help?
February 16, 2018 at 4:20 pm #1455889Barry
MemberHi there @dialogue99,
I’m really sorry to hear you’re hitting up against difficulties.
Though it certainly appears to be linked to our plugin, it could very well be the case that your theme (or a different plugin) is actually behind this issue.
Under the hood, WordPress builds up each page using lots of individual database queries. One of those queries is regarded as the main query and that is what our plugin is trying to work with in this particular scenario. Unfortunately, a pattern we occasionally see with some themes (plugins too, but mostly themes) is that they overwrite the main query and change it in a way that triggers this problem.
I notice that when you opened this topic you noted having attempted to disable all other plugins and I’m guessing that didn’t help. Have you been able to switch to a default theme such as Twenty Seventeen, though, to see if that clears the issue? If it does, that would indicate that the true source of the problem is in your theme and that perhaps it is committing the misdemeanor I outlined above.
Are you able to confirm if that is the case? Please see our troubleshooting guide if you are unfamiliar with this process, as it includes tips about minimizing and avoiding disruption on a live site (by either using a staging site or by using the Health Check plugin to enter a special troubleshooting mode).
Let me know if you have any further questions about this process 🙂
February 17, 2018 at 5:08 am #1456176dialogue99
ParticipantHi Barry
thanks for your reply. I tried to disable all plugins, but I cannot change the theme. The page I showed you with the screenshot is the user dashboard for the directory theme we are using – Listinpro. If I disable the theme, then that dashboard area is no longer available.
This looks like a conflict between your plugin and our theme. We cannot work with a different theme, the whole site can only exist with that theme, that runs the whole directory site. This is not news, I found this:
Conflict – Events Calendar Pro plugin interferes with the theme
Is there a way to solve this? If not, I will have to ask your for a refund for the two plugins we bought from you, as if they create conflicts that cannot be fixed they are absolutely no use for us. Do you want FTP and wordpress access so that you can have a look? I really hope this can be fixed.
Thank you
andrea
February 19, 2018 at 4:42 pm #1458171Barry
MemberI can’t FTP in and don’t think admin access would be useful in this case. If you could send a zip or link to a zip of your theme, though, perhaps I can take a look at it and see if I can identify the source of the issue.
In parallel to this, it could also be worth reaching out to your theme’s support team and asking if there is anywhere in the code where they overwrite or nullify the global $wp_query object, which is the most common cause of this problem.
Thanks!
February 20, 2018 at 1:41 am #1458368dialogue99
ParticipantThis reply is private.
February 20, 2018 at 1:56 am #1458376dialogue99
ParticipantPS: in the screenshot you see in the first post, the errors are triggered as soon as you click on “my listings” and then “published” in the side menu. The “saved” link just below that also triggers them. Everything else seems to work ok
February 20, 2018 at 8:51 am #1458790dialogue99
ParticipantThis reply is private.
February 20, 2018 at 12:05 pm #1459043Barry
MemberThis reply is private.
February 20, 2018 at 12:22 pm #1459061dialogue99
ParticipantYes, I am using the child theme (nothing modified in there so far though)
February 20, 2018 at 4:13 pm #1459270Barry
MemberGotcha – thanks! Will get back to you shortly 🙂
February 22, 2018 at 4:06 pm #1461564Barry
MemberHi there, @dialogue99.
Just wanted to confirm I was able to set up the theme and while setting things up to replicate this seems rather involved I can see what I believe to be the problem in the theme code, which is this sort of pattern:
$wp_query = null; $wp_query = new WP_Query($args);
The problem is that the first of those lines wipes out WordPress’s global query object completely, leading to problems like the one you documented above.
The second line replaces it with a fresh query object, but what is often forgotten is that lots of code runs during the construction of the new query object and, until that process completes, code accessing the main $wp_query object will hit a wall.
I’ll shoot a note to the theme author as you requested 🙂
February 23, 2018 at 1:48 am #1461773dialogue99
ParticipantOk thank you Barry. One question: if this cannot be resolved, can we deactivate our licence and get a refund? We are really hoping to be able to use your software, as it is just what we need for your site, however it is a directory site and if it cannot work with out theme (the provides all the functionality the site needs) then it becomes totally unusable to us.
Both I and the client are very small businesses (we are sole traders) and even small amounts like this are an issue for us. My client is not a charity, but the service will be free for everyone for 1 year, and will remain free for all non-business, council and charities. It is very much a service that the very small communities in the Islands of Mull and Iona (you are looking at 3000 people living in both Islands) have been crying out for a while.
Is this an option if the conflict cannot be solved?
All the best
Andrea
February 23, 2018 at 9:37 am #1462189Barry
MemberHi Andrea,
We are happy to offer a refund within 30 days of purchase (and it looks like you are still within that window).
Given the nature of the problem I think it is best if the theme developers resolve this and of course I can’t speak to how quickly that will happen, unfortunately, but perhaps you could press them on this point?
Thanks!
February 23, 2018 at 9:39 am #1462192Barry
MemberThis reply is private.
February 23, 2018 at 10:21 am #1462247dialogue99
ParticipantThis reply is private.
-
AuthorPosts
- The topic ‘Fatal error: Call to a member function is_main_query() on a non-object’ is closed to new replies.
