• Resolved helpfulwebhosting

    (@helpfulwebhosting)


    Hello

    One of our customers has started to get this error on her site afrikanyoga.com

    Other discussion threads have suggested that the ‘Testimonials’ plug-in might be to blame. We have that but we have tried disabling it and things didn’t get any better.

    You can see the problem page at

    The error message is Call to a member function is_main_query() on a non-object in […] public_html/wp-content/plugins/the-events-calendar/lib/the-events-calendar.class.php on line 2153

    Any advice on how to overcome this would be much appreciated

    https://www.ads-software.com/plugins/the-events-calendar/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Thread Starter helpfulwebhosting

    (@helpfulwebhosting)

    quick follow-up. It occurs to me that the page that causes this error is a ‘portfolio’ page. Other people talking about the same error online have mentioned the Testimonials plug-in. This might suggest that the problem has to do with custom post types.

    Have you tried deactivating all other plugins and switching to a default, unmodified theme such as Twenty Twelve – and does the problem still occur under those conditions?

    Thanks!

    Thread Starter helpfulwebhosting

    (@helpfulwebhosting)

    Thanks for your suggestion. We have already rolled back the Calendar Plug-in to an earlier version and things are working ok again. We’ll wait for a later release before trying the update again.

    It seems that this problem is somehow linked to custom post types. It seems quite widespread now. If you google the error message I provided you’ll see that it shows as page results for a number of sites that use this plug-in. The error message has now been incorporated into each site’s Google index.

    I’m sure that’s true, but it’s not necessarily a problem in our plugin even so (though of course it could be – but unless users can troubleshoot it is of course difficult to ascertain).

    What I can say is that we’ve seen more than one theme – and it’s not impossible that certain other plugins do something similar – that set the global $wp_query object to null and this can have numerous knock-on effects including the error you quoted being generated.

    If you’re happy for the time being though that’s the main thing, of course and hopefully this will resolve itself as our plugin and perhaps other plugins/your theme are updated over time ??

    I updated the plugin yesturday and am now getting:

    Fatal error: Call to a member function is_main_query() on a non-object in …/public_html/wp-content/plugins/the-events-calendar/lib/the-events-calendar.class.php on line 2150

    Plugin was working before update. This is a running on a brand new cpanel server with centos 6.5 x64. No customization and this is the only site running on the box.

    Any suggestions ?

    Thanks in advance

    Sometimes themes (or other plugins, custom code etc) destroy the global query object set by WordPress and then restore it later – if our code tries to access it during the period where it is no longer available then this can indeed happen.

    Is that a possibility? The way to confirm this would be to deactivate all other plugins and switch to a default, unmodified theme.

    I had the same issue and was able to resolve it by simply removing $wp_query = null; from my custom wp_query( see below) . However I believe it is recommended practice to have that line in there, so I hope that helps you correct the issue as way to many themes will have that line in there!

    <?php
    $temp = $wp_query;
    $wp_query = null;
    $wp_query = new WP_Query(
    array(
    'posts_per_page' => 1,
    'paged' => $paged)
    );
    ?>

    Thanks for the post: on our end, I’d close by saying we can offer no guarantees if the $wp_query global is overridden during execution.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Call to a member function is_main_query() … on line 2153’ is closed to new replies.