wpdatatables_filter_string_cell

Contents

Description

This filter is applied to the value of a string cell before it is passed to the front-end.

Usage

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
add_filter( 'wpdatatables_filter_string_cell', 'filter_string_cell', 10, 2 );
add_filter( 'wpdatatables_filter_string_cell', 'filter_string_cell', 10, 2 );
add_filter( 'wpdatatables_filter_string_cell', 'filter_string_cell', 10, 2 );

Parameters

  • $formattedValue string
    String cell value.
  • $tableId integer
    ID of table from database.

Examples

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Callback function for the wpdatatables_filter_string_cell filter hook
function filter_string_cell( $formattedValue, $tableId ) {
if($tableId != 1 && is_numeric($formattedValue)) {
return '<a href="https:/mysite.org/' .$formattedValue . '">Link to Post ' . $formattedValue . '</a>';
}
return $formattedValue;
}
add_action( 'wpdatatables_filter_string_cell', 'filter_string_cell', 10, 2);
// Callback function for the wpdatatables_filter_string_cell filter hook function filter_string_cell( $formattedValue, $tableId ) { if($tableId != 1 && is_numeric($formattedValue)) { return '<a href="https:/mysite.org/' .$formattedValue . '">Link to Post ' . $formattedValue . '</a>'; } return $formattedValue; } add_action( 'wpdatatables_filter_string_cell', 'filter_string_cell', 10, 2);
// Callback function for the wpdatatables_filter_string_cell filter hook
function filter_string_cell( $formattedValue, $tableId ) { 
   if($tableId != 1 && is_numeric($formattedValue)) {
           return 'Link to Post ' . $formattedValue . '';
   } 
   return $formattedValue; 
}

add_action( 'wpdatatables_filter_string_cell', 'filter_string_cell', 10, 2);