See video usage example

WordPress Actions are a convenient way to “hook” into different plugins without actually changing their code. Basically, “actions” are user-defined functions, assigned to certain labels, which are called by the plugin core at defined moments of its execution. Unlike filters, actions do not return any data, they are just 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.

wpdatatables_before_get_table_metadata( $table_id )

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 some function that you need, or set some global variable.

wpdatatables_before_get_columns_metadata( $table_id )

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

wpdatatables_before_render_table( $table_id )

This action is executed before the table has starting to render (either by shortcode or without it).

wpdatatables_after_save_settings()

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

wpdatatables_after_save_table( $table_id )

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

wpdatatables_after_save_columns()

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

wpdatatables_settings_page()

This action is executed when the settings page is open in the backend

wpdatatables_addnew_page()

This action is executed when user opens the “Add new wpDataTable” in the backend

wpdatatables_browse_page()

This action is executed when 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, $table_id )

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 PHPDataTable object (class source/class.table.php).

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

wpdatatables_after_insert_column( $column, $table_id )

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

$column is the column object (source/class.column.php and its children)

$table_id is the identifier of the table from MySQL

wpdatatables_admin_styles()

This action is executed when the CSS files for the wpDataTables admin panel are enqueued.

wpdatatables_admin_scripts()

This action is executed when the JS files for the admin panel are enqueued.

wpdatatables_get_ajax_data( $table_id )

This action is executed before AJAX data is fetched for the server-side processing tables. $table_id is the table identifier from the MySQL table.

wpdatatable_before_render_chart( $table_id )

This action is executed before chart starts to render. $table_id is the table identifier from the MySQL table.

wpdatatables_after_frontent_edit_row( $formdata, $row_id_value, $table_id )

This action is executed after editing action was applied. $formdata is the array of keys and values for editing, $row_id_value is the ID field of the row in MySQL table that was edited, $table_id is the table identifier from the MySQL plugin table (wp_wpdatatables)

wpdatatables_before_delete_row( $row_id, $table_id )

This action is called before a row is deleted from the frontend editor. $row_id is the value of ID column, $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_delete_file ( $row_id, $table_id )

This action is called before an uploaded file is deleted from the frontend editor. $row_id is the value of ID column, $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_filtering_form( $table_id );

This action is called before the filtering form is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_after_filtering_form( $table_id );

This action is called after the filtering form is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_table( $table_id )

This action is called before the table itself is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_after_table( $table_id )

This action is called after the table is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_header( $table_id )

This action is called before the table header TR element is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_after_header( $table_id )

This action is called after the table header TR element is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_footer( $table_id )

This action is called before the table footer TR element is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_after_footer( $table_id )

This action is called after the table footer TR element is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_first_row( $table_id )

This action is called before first table row is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_before_row( $table_id, $row_index )

This action is called before the table row is rendered on the page. $table_id is the table ID from wp_wpdatatables table, $row_index is a zero-based index of the row.

wpdatatables_after_row( $table_id, $row_index )

This action is called after the table row is rendered on the page. $table_id is the table ID from wp_wpdatatables table, $row_index is a zero-based index of the row.

wpdatatables_before_editor_dialog( $table_id )

This action is called before the table editor dialog (only for editable tables) is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_after_editor_dialog( $table_id )

This action is called after the table editor dialog (only for editable tables) is rendered on the page. $table_id is the table ID from wp_wpdatatables table.

wpdatatables_admin_before_edit

Action you that is called before the table configuration section in admin part. You can use this action to include custom block and settings for the table

Never miss new features!

Join 2000+ newsletter subscribers

Never miss notifications about new cool features, promotions, giveaways or freebies - subscribe to our newsletter! We send about one mail per month, and do our best to keep our announcements interesting.

We never spam or disclose your address to anyone.