wpdatatables_try_generate_table

Contents

Description

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 database based on the results.

Usage

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
add_action( 'wpdatatables_try_generate_table', 'try_generate_table', 10, 2 );
add_action( 'wpdatatables_try_generate_table', 'try_generate_table', 10, 2 );
add_action( 'wpdatatables_try_generate_table', 'try_generate_table', 10, 2 );

Parameters

  • $type string
    Table type (xls, CSV, MySQL, JSON, XML, PHP…).
  • $content string
    Content is either a link to the data source file or a MySQL query.

Examples

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Callback function for the wpdatatables_try_generate_table action hook
function try_generate_table( $type, $content ) {
// Check for specific table type
if ( $type == 'xls') {
// Your code
}
}
add_action( 'wpdatatables_try_generate_table', 'try_generate_table', 10, 2 );
// Callback function for the wpdatatables_try_generate_table action hook function try_generate_table( $type, $content ) { // Check for specific table type if ( $type == 'xls') { // Your code } } add_action( 'wpdatatables_try_generate_table', 'try_generate_table', 10, 2 );
// Callback function for the wpdatatables_try_generate_table action hook
function try_generate_table( $type, $content ) { 
   // Check for specific table type
   if ( $type == 'xls') { 
     // Your code
   } 
}

add_action( 'wpdatatables_try_generate_table', 'try_generate_table', 10, 2 );