wpdatatables_extend_wpdatatable_object

Contents

Description

The wpdatatables_extend_wpdatatable_object action is triggered after the wpDataTable object is populated with table and column data. You can use this hook to modify or extend the table object with additional properties or logic before it is rendered.

Usage

add_action('wpdatatables_extend_wpdatatable_object', 'my_extend_wpdatatable_object', 10, 2);

Parameters

  • $this object
    The wpDataTable object instance being populated.
  • $tableData object
    The data object containing table settings and metadata.

Examples

// Example: Add a custom property to the wpDataTable object
function my_extend_wpdatatable_object($wpdatatable, $tableData) {
    // Add a custom flag based on table type
    if ($tableData->table_type === 'manual') {
        $wpdatatable->customFlag = true;
    }
}
add_action('wpdatatables_extend_wpdatatable_object', 'my_extend_wpdatatable_object', 10, 2);