wpDataTables actions to use in WordPress

wpDataTables actionsActions defined in wpDataTables plugin for customizations

WordPress Actions provide a convenient way to “hook” into different plugins without changing their code. Basically, “actions” are user-defined functions, assigned to certain labels, that are called by the plugin core at defined moments of its execution. Unlike filters, actions do not return any data, they are simply executed.

You can read more about using WordPress actions and assigning your functions to actions in WordPress Codex. Here, we will provide a list of actions defined in wpDataTables plugin that you can use to customize it for your needs.

Please note that using hooks requires certain level of programming skills and included support refers only to advice.

wpdatatables_before_get_table_metadata( $tableId )

This action is executed before the table metadata is fetched from the database (table settings, link to the file or the SQL query). You can use it to call a function you need, or set a global variable.

wpdatatables_before_get_columns_metadata( $tableId )

This action is executed before the columns metadata is fetched from the database (column settings). You can use it to call a function you need, or set some global variable.

wpdatatables_before_render_table( $tableId )

This action is executed before the table starts to render (either with or without a shortcode).

wpdatatables_after_save_settings()

This action is executed after wpDataTables saves the settings data (after the user presses “Save settings” in the backend settings page).

wpdatatables_after_save_table( $tableId )

This action is executed after wpDataTables saves the table data (after the user presses “Save table” in the backend settings page).

wpdatatables_after_save_columns()

This action is executed after wpDataTables saves the column data (after the user presses “Save table” in the backend settings page).

wpdatatables_settings_page()

This action is executed when the settings page is open in the back-end.

wpdatatables_addnew_page()

This action is executed when the user opens the “Add new wpDataTable” in the back-end.

wpdatatables_browse_page()

This action is executed when the user opens the browse page.

wpdatatables_try_generate_table( $type, $content )

This action is executed when a new table is first saved: wpDataTables tries to generate the table based on the provided data, and creates the columns and tables in the databased based on the results.

$type is the table type (xls, csv, mysql, json, xml, php).

$content is either a link to the data source file, or MySQL query.

wpdatatables_before_create_columns( $table, $tableId, $frontendColumns )

This action is executed before the column data is saved to the database (when the Save columns button is clicked in the admin panel).

$table is the wpDataTable object (class source/class.wpdatatable.php).

$tableId is the ID of the table description in MySQL.

$frontendColumns is the array of objects where every object is column from the front-end.

wpdatatables_after_insert_column( $columnConfig, $tableId )

This action is executed after the new column is inserted in the database (when the columns are first generated by the plugin).

$columnConfig is the array of column settings loaded from the database.

$tableId is the identifier of the table from MySQL.

wpdatatables_get_ajax_data( $tableId )

This action is executed before AJAX data is fetched for the server-side processing tables.

$tableId is the table identifier from the MySQL table.

wpdatatables_before_render_chart( $chartId )

This action is executed before a chart starts to render.

$chartId is the table identifier from the MySQL table.

wpdatatables_after_frontent_edit_row( $formdata, $rowId, $tableId )

This action is executed after editing action is applied.

$formdata is the array of keys and values for editing.

$rowId is the ID field of the row in MySQL table that was edited.

$tableId is the table identifier from the MySQL plugin table (wp_wpdatatables).

wpdatatables_before_delete_row( $rowId, $tableId )

This action is called before a row is deleted from the frontend editor.

$rowId is the value of ID column.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_before_filtering_form( $tableId )

This action is called before the filtering form is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_after_filtering_form( $tableId )

This action is called after the filtering form is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_before_table( $tableId )

This action is called before the table itself is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_after_table( $tableId )

This action is called after the table is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_before_header( $tableId )

This action is called before the table header TR element is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_after_header( $tableId )

This action is called after the table header TR element is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_before_first_row( $tableId )

This action is called before the first table row is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_before_row( $tableId, $rowIndex )

This action is called before the table row is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

$rowIndex is a zero-based index of the row.

wpdatatables_after_row( $tableId, $rowIndex )

This action is called after the table row is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

$rowIndex is a zero-based index of the row.

wpdatatables_before_editor_dialog( $tableId )

This action is called before the table editor dialog (only for editable tables) is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_after_editor_dialog( $tableId )

This action is called after the table editor dialog (only for editable tables) is rendered on the page.

$tableId is the table ID from wp_wpdatatables table.

wpdatatables_admin_before_edit()

You call this action before the table configuration section in admin part. You can use this action to include a custom block and settings for the table