How to disable sorting in Posts Table Pro
If you want to disable sorting for individual columns in your Posts Table Pro tables, please see the posts_table_column_sortable
hook in the Developer Documentation.
For a non-developer option, you can also disable sorting by hiding the entire table header row - this option can be found on the plugin settings page.
Disable all sorting
If you want to completely disable column sorting, you can use the following code. Add it to a custom plugin or inside your theme's functions.php
file:
// Disable column sorting add_filter( 'posts_table_data_config', function( $config ) { $config['ordering'] = false; return $config; } );
Please note: this will completely disable the ability to sort the table, and means the sort_by
option can no longer be used.
Disable sorting on specific pages only
The following code snippet will disable sorting in the tables on specific pages only - simply replace "144" with the ID of the page that you want to disable sorting on:
// Disable column sorting add_filter( 'posts_table_data_config', function( $config ) { if ( is_page(144) ) { $config['ordering'] = false; } return $config; } );