1. Home
  2. Knowledge Base
  3. Posts Table Pro
  4. Advanced Usage

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.

Display 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;
} );

Related Articles

If searching the knowledge base hasn't answered your question, please contact support.