wpdatatables_add_class_to_filter_in_form_element

Contents

Description

The filter allows you to add custom CSS classes to the filtering form element.

Usage

add_filter('wpdatatables_add_class_to_filter_in_form_element', 'custom_filter_classes', 10, 2);

Parameters

  • $customClasses string
    The default CSS classes for the filtering form element.
  • $tableId int
    The ID of the wpDataTable where the filtering form is being displayed.

Examples

// Callback function for the wpdatatables_add_class_to_filter_in_form_element filter
function custom_filter_classes($customClasses, $tableId) {
    // Example: Add a custom class to a specific table
    if ($tableId == 1) {
        $customClasses .= ' custom-class-for-table-1';
    }

    return $customClasses;
}

add_filter('wpdatatables_add_class_to_filter_in_form_element', 'custom_filter_classes', 10, 2);