Created
May 27, 2022 19:27
-
-
Save zackkatz/88e2bc5e315e4daffbc3f9d6220e7e5d to your computer and use it in GitHub Desktop.
GravityView DataTables - Prevent state saving when refreshing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'gravityview_datatables_js_options', 'gv_dt_prevent_state_save', 10, 3 ); | |
/** | |
* Prevent DataTables from saving state between page loads. | |
* @param array $dt_config DataTables options | |
* @param int $view_id View ID | |
* @param WP_Post $post Current WordPress post object | |
* | |
* @return mixed | |
*/ | |
function gv_dt_prevent_state_save( $dt_config, $view_id, $post ) { | |
$dt_config['stateSave'] = false; | |
return $dt_config; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment