wpdatatables_filter_query_before_limit

Contents

Description

This filter is applied to a generated MySQL query before a ‘LIMIT’ for pagination is added and before it is sent to the MySQL server. Handy for customizing tables with server-side processing.

Usage

add_filter( 'wpdatatables_filter_query_before_limit', 'filter_query_before_limit', 10, 2 );

Parameters

  • $query string
    Query string.
  • $tableId integer
    ID of table from database.

Examples

// Callback function for the wpdatatables_filter_query_before_limit filter hook
function filter_query_before_limit( $query, $tableId ) { 
   // Check for specific table Id
   if ( $tableId == 1) { 
     // Your code
   } 
}

add_action( 'wpdatatables_filter_query_before_limit', 'filter_query_before_limit', 10, 2);