Skip to content

Instantly share code, notes, and snippets.

@rafaehlers
Last active July 25, 2019 20:44
Show Gist options
  • Save rafaehlers/2182c05594772af245db630047646428 to your computer and use it in GitHub Desktop.
Save rafaehlers/2182c05594772af245db630047646428 to your computer and use it in GitHub Desktop.
DataTables ignore the Sort option from View Settings. This code fixes it.
<?php //this entire line should be removed when copying this code, before pasting it into your functions.php file
/** Remove default order from DataTables */
add_filter( 'gravityview_datatables_js_options', function( $dt_config, $view_id, $post ) {
$dt_config['order'] = array();
$dt_config['stateSave'] = false;
return $dt_config;
}, 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment