• Resolved therealgilles

    (@chamois_blanc)


    I see the following PHP warning related to the AC Events Calendar Addon:

    NOTICE: wp-includes/functions.php:5775 - is_main_query was called incorrectly. In pre_get_posts, use the WP_Query->is_main_query() method, not the is_main_query() function. See https://developer.wordpress.org/reference/functions/is_main_query/. Please see Debugging in WordPress for more information. (This message was added in version 3.7.0.)
    WP_List_Table->display, WP_List_Table->display_rows_or_placeholder, WP_Posts_List_Table->display_rows, WP_Posts_List_Table->_display_rows, WP_Posts_List_Table->single_row, WP_List_Table->single_row_columns, WP_Posts_List_Table->column_default, do_action('manage_tribe_events_posts_custom_column'), WP_Hook->do_action, WP_Hook->apply_filters, AC\ListScreen\Post->manage_value, AC\ListScreen->get_display_value_by_column_name, apply_filters('ac/column/value'), WP_Hook->apply_filters, PodsMeta->cpac_meta_value, PodsAPI->load_pod, PodsAPI->_load_object, PodsAPI->_load_objects, Pods\Whatsit\Storage\Post_Type->find, WP_Query->query, WP_Query->get_posts, do_action_ref_array('pre_get_posts'), WP_Hook->do_action, WP_Hook->apply_filters, ACA\EC\Sorting\EventSortingFix->deregister_tribe_sorting_hooks, is_main_query, _doing_it_wrong, trigger_error

    I think it was to do with this code in ac-addon-events-calendar/classes/Sorting/EventSortingFix.php:

    
      public function deregister_tribe_sorting_hooks( WP_Query $wp_query ){
        if( ! class_exists( 'Tribe__Events__Main' ) || ! class_exists( 'Tribe__Events__Admin_List' ) ||! is_main_query() ){
          return;
        }
    

    is_main_query() should probably be $wp_query->is_main_query() instead.

    • This topic was modified 1 year, 11 months ago by therealgilles.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘AC Events Calendar Add-on – PHP warning is_main_query()’ is closed to new replies.