wpdatatables_filter_total_length_query

Contents

Description

This filter allows developers to modify the SQL query used to calculate the total number of rows in a query-based wpDataTable, later used for pagination or filtering. It can be used to adjust the query before it’s executed, allowing for custom row counts or specific filtering conditions.

Usage

add_filter( 'wpdatatables_filter_total_length_query', 'modify_total_length_query', 10, 2 );

Parameters

  • $totalLengthQuery string
    The SQL query used to calculate the total length of the result set.
  • $wpId int
    The unique identifier for the wpDataTable.

Examples

// Callback function for the wpdatatables_filter_total_length_query filter hook
function modify_total_length_query($totalLengthQuery, $wpId) {
    // Your code here

    return $totalLengthQuery;
}

add_filter( 'wpdatatables_filter_total_length_query', 'modify_total_length_query', 10, 2 );