Datatables breaks when gtranslate bar appear

Datatables breaks when gtranslate bar appear

pok4pok4 Posts: 2Questions: 0Answers: 0

Im new here and my english is not good.
My website have admin panel (its based on wp 6.3.1)
Im using payed template from themeforest (codecanyon/envato). Everything is good, but when i added this shortcode:echo do_shortcode('[gtranslate]'); and when google translate bar appear - datatables stop working.
It gives me this error:
DataTables warning: table id=din-table - Invalid JSON response. For more information about this error, please see

I try to add a class to tables with jquery $("body").find(".tableWrap").addClass("notranslate"); and when i open dev console and inspect the element - the class is added and the tables not translated, but error still appear.
Can you gives me a suggestion how to fix this issue ?
Version of the datatables is: 1.10.12 and datatables responsive: 2.1.0

Thanks for any replies!


  • kthorngrenkthorngren Posts: 19,864Questions: 26Answers: 4,685
    edited October 2023

    The place to start is to use the troubleshooting steps found at the link in the error:

    Let us know what you find.

    Can you post a link to your page or a test case showing the error so we can help debug?


  • pok4pok4 Posts: 2Questions: 0Answers: 0
    edited October 2023

    The problem is inserting the do_shortcode('[gtranslate]') without event.
    when i type in my functons.php echo do_shortcode('[gtranslate]') - the widget is inserted above all html elements before <html> tag.
    I search and found a event inside body tag and my code looks like this now:

        if(str_contains($_SERVER['REQUEST_URI'],'wp-admin') && (sw_user_in_role(NEXOS_USER_TYPE_AGENT) || sw_user_in_role(NEXOS_USER_TYPE_OWNER) || sw_user_in_role(NEXOS_USER_TYPE_AGENCY))){
        function gtranslate_bar() {
            echo do_shortcode('[gtranslate]');

    everything is OK for now. The event admin_notices is about insert a alert boxes but i cant found proper event.. My template is payed and is not good at all... I search for different events for wp like wp_footer or wp_body but i try with them without success..
    Maybe my template is not supporting them..

    For now everything is OK, thank you !

    Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

  • colincolin Posts: 15,087Questions: 1Answers: 2,580

    My template is payed and is not good at all...

    Just a note to say that DataTables is open source and entirely free. If you've paid for something that isn't providing the expected functionality, it would be worth contacting the provider and explaining to them,


Sign In or Register to comment.