I received this reply from Tablepress support regarding the JavaScript conflict.
Here is their reply:
From what I can see, “The Events Calendar” is also loading a copy of the JavaScript code of the DataTables JavaScript library on the page. This is the external code library that TablePress uses to add e.g. sorting, searching, and pagination.
TablePress currently ships with the newest version 2.3.8 of that library. However, “The Events Calendar” loads the VERY old version 1.13.8 . This old version then interferes with TablePress as it breaks the modern integration. In addition, it loads that despite not even printing any table or events on that page, which obviously is wasteful and bad for performance.
So, I’m afraid that this is something that will need to be fixed in “The Events Calendar”: They should not only ship a modern version of the DataTables library, but they should then also only load it if it’s actually needed on the page.
Can you fix this please?
Plugin Support
Darian
(@d0153)
Hi @crowesnest
Thanks for reaching out.
To properly investigate this issue, could you please share the URL where we can reproduce or view the error message you mentioned above? This will allow us to check it further on our end and run some tests directly.
Plugin Support
Darian
(@d0153)
Hi @crowesnest
Thanks for your response.
Could you try the following workaround and see if it works on your end?
add_action( 'wp_enqueue_scripts', function () {
if ( is_admin() || ! is_singular() ) {
return;
}
$post = get_post();
if ( ! $post ) {
return;
}
// Does this page actually render a TablePress table?
$has_tablepress = has_shortcode( $post->post_content, 'table' ) // [table id=...]
|| has_block( 'tablepress/table', $post ) // block editor
|| false !== strpos( $post->post_content, 'tablepress-' ); // raw markup fallback
if ( ! $has_tablepress ) {
return;
}
foreach ( [ 'tribe-datatables', 'datatables' ] as $handle ) {
wp_dequeue_script( $handle );
wp_deregister_script( $handle );
}
wp_dequeue_style( 'datatables-css' );
wp_deregister_style( 'datatables-css' );
}, 100 );
If you’re not familiar with coding, you can use the Code Snippets plugin, which removes the need to add custom snippets to your theme’s functions.php file.
As always, please test this first on a staging site before applying to your live site.
Let me know how it goes.
That seems to have fixed it. Both plugins appear to be working correctly.
Thanks for the fix.
-
This reply was modified 5 days, 12 hours ago by
crowesnest.