• Resolved mattiaguatta

    (@mattiaguatta)


    Hello,

    on my webiste when i activate the w3 total cache plugin i see this error in error log

    [27-Jan-2020 10:57:15 UTC] PHP Fatal error: Uncaught Error: Cannot use object of type WP_Query as array in /home/itprofessione/public_html/wp-content/plugins/w3-total-cache/Util_Environment.php:1041
    Stack trace:
    #0 /home/itprofessione/public_html/wp-content/plugins/w3-total-cache/Generic_Plugin.php(311): W3TC\Util_Environment::detect_post_id()
    #1 /home/itprofessione/public_html/wp-includes/class-wp-hook.php(288): W3TC\Generic_Plugin->admin_bar_menu(Object(WP_Admin_Bar))
    #2 /home/itprofessione/public_html/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array)
    #3 /home/itprofessione/public_html/wp-includes/plugin.php(544): WP_Hook->do_action(Array)
    #4 /home/itprofessione/public_html/wp-includes/admin-bar.php(86): do_action_ref_array(‘admin_bar_menu’, Array)
    #5 /home/itprofessione/public_html/wp-includes/class-wp-hook.php(288): wp_admin_bar_render(”)
    #6 /home/itprofessione/public_html/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters(NULL, Array)
    #7 /home/itprofessione/public_html/wp-includes/plugin.php(478): WP_Hook->do_action( in /home/itprofessione/public_html/wp-content/plugins/w3-total-cache/Util_Environment.php on line 1041

    why?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @mattiaguatta

    I am sorry about the issue you are experiencing and I am happy to assist you with this.

    When you are on a custom page where you defined your query something like:

    $posts= new WP_Query( $args );

    Your object $posts will overwrite the global posts variable in the plugin and you’ll get this error.

    To get around this, just rename your query object to $posts_myname or similar and you won’t have any issues.

    Thank you!

    Is this a new issue? We weren’t experiencing this prior to updating from 0.10.1 to 0.13.1

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘W3 TOTAL CACHE FATAL ERROR’ is closed to new replies.