We receive this error when using the events table shortcode on our page. I’ve disabled all custom templates for this plugin. Please help us diagnose.
Versions:
WP – 6.3
PHP – 8.0
EE — Version 5.0.9.p (our error has been occurring since the 5.0 update)
EE Table View — Version 1.3.9.p
Shortcode: [ESPRESSO_TICKET_SELECTOR Error:
[17-Aug-2023 15:44:25 UTC] WordPress database error Unknown column 'event_start_date' in 'order clause' for query
SELECT SQL_CALC_FOUND_ROWS wp_pgrq_posts.ID
FROM wp_pgrq_posts INNER JOIN wp_pgrq_esp_datetime ON ( wp_pgrq_posts.ID = wp_pgrq_esp_datetime.EVT_ID )
WHERE 1=1 AND ((wp_pgrq_posts.post_type = 'espresso_events' AND (wp_pgrq_posts.post_status = 'publish' OR wp_pgrq_posts.post_status = 'acf-disabled' OR wp_pgrq_posts.post_status = 'cancelled' OR wp_pgrq_posts.post_status = 'postponed' OR wp_pgrq_posts.post_status = 'sold_out'
OR wp_pgrq_posts.post_status = 'private'))) AND wp_pgrq_esp_datetime.DTT_EVT_end > '2023-08-17 15:44:25'
GROUP BY wp_pgrq_posts.ID
ORDER BY event_start_date ASC
LIMIT 0, 1000
made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/gsna/page.php'), get_header, locate_template, load_template, require_once('/themes/gsna/header.php'), wp_head, do_action('wp_head'), WP_Hook->do_action, WP_Hook->apply_filters, AIOSEO\Plugin\Common\Main\Head->init, AIOSEO\Plugin\Common\Main\Head->output, require('/plugins/all-in-one-seo-pack/app/Common/Views/main/meta.php'), AIOSEO\Plugin\Common\Meta\Description->getDescription, AIOSEO\Plugin\Common\Meta\Description->getPostDescription, AIOSEO\Plugin\Common\Meta\Helpers->sanitize, AIOSEO\Plugin\Common\Utils\Tags->replaceTags, AIOSEO\Plugin\Common\Utils\Tags->getTagValue, AIOSEO\Plugin\Common\Utils\Helpers->getDescriptionFromContent, AIOSEO\Plugin\Common\Utils\Helpers->getPostContent, AIOSEO\Plugin\Common\Utils\Helpers->theContent, AIOSEO\Plugin\Common\Utils\Helpers->doShortcodes, AIOSEO\Plugin\Common\Utils\Helpers->doShortcodesHelper, do_shortcode, preg_replace_callback, do_shortcode_tag, EES_Espresso_Events_Table_Template->process_shortcode, EE_Events_Table_Template_Query->__construct, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
Actions taken:
Embedded single EE event — worked, but we want the table view
Disabled custom templates — same error
Updated plugins — same error Disabled AIOSEO — although it’s referenced often in the error, we get the same error with this plugin disabled
I’ve been looking into this but so far I’ve not been able to reproduce it.
You’ve mentioned you’ve tested this with AIOSEO disabled but still get the error, do you have the full stack trace from when you get that error? I assume it’s different as the code can’t then reference AIOSEO if it’s disabled.
Do you have a staging/dev site I can view this on or just live?
Thanks for your quick response. I’ve been doing more digging and testing. Unfortunately, this is a tricky site to provide access to.
Based on your feedback, I double-checked and have confirmed that the error occurs when AIOSEO is disabled — here is that error.
[18-Aug-2023 20:08:17 UTC] WordPress database error Unknown column 'event_start_date' in 'order clause' for query
SELECT SQL_CALC_FOUND_ROWS wp_pgrq_posts.ID
FROM wp_pgrq_posts INNER JOIN wp_pgrq_esp_datetime ON ( wp_pgrq_posts.ID = wp_pgrq_esp_datetime.EVT_ID )
WHERE 1=1 AND ((wp_pgrq_posts.post_type = 'espresso_events' AND (wp_pgrq_posts.post_status = 'publish' OR wp_pgrq_posts.post_status = 'acf-disabled' OR wp_pgrq_posts.post_status = 'cancelled' OR wp_pgrq_posts.post_status = 'postponed' OR wp_pgrq_posts.post_status = 'sold_out'
OR wp_pgrq_posts.post_status = 'private'))) AND wp_pgrq_esp_datetime.DTT_EVT_end > '2023-08-18 20:08:17'
GROUP BY wp_pgrq_posts.ID
ORDER BY event_start_date ASC
LIMIT 0, 1000
made by require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), include('/themes/gsna/page.php'), the_content, apply_filters('the_content'), WP_Hook->apply_filters, do_shortcode, preg_replace_callback, do_shortcode_tag, EES_Espresso_Events_Table_Template->process_shortcode, EE_Events_Table_Template_Query->__construct, WP_Query->__construct, WP_Query->query, WP_Query->get_posts
I’ve also tracked down the source of the error, which may be the use of deprecated code in EE v5. Please see: /event-espresso-core/core/helpers/EEH_Event_Query.helper.php #663
After commenting out line #663, our table view is now working. I’m curious if you can review the code on this line and let me know if it’s a bug in EE or if there’s another reason for the error code we’re receiving.
In the short term, I’ve found a path forward and will continue to monitor this thread.
I’m Event Espresso’s lead developer. We don’t use SQL_CALC_FOUND_ROWS anywhere in any of our plugins’ code. I’m pretty sure something else is hijacking that query and replacing the SELECT clause with SQL_CALC_FOUND_ROWS and thus removing where we define MIN( wp_esp_datetime.DTT_EVT_start ) as event_start_date. This is why you are getting the Unknown column 'event_start_date' in 'order clause' for query error.
I have over 100 plugins installed on my local WordPress development site, and the only one that uses SQL_CALC_FOUND_ROWS is Gravity Forms. Is that active on your site? The only other place I know of that uses SQL_CALC_FOUND_ROWS is WordPress Multisite installations, but I’m going to assume that is not the case with your site. Are you able to deactivate other plugins one by one until you find the one that is hijacking our query?
Viewing 3 reply threads
The support post ‘Events Table View Error’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.