wpdatatables_filter_link_cell

Contents

Description

This filter is applied to the value of an URL link cell before it is passed to the front-end.

Usage

add_filter( 'wpdatatables_filter_link_cell', 'filter_link_cell', 10, 2 );

Parameters

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

Examples

// Callback function for the wpdatatables_filter_link_cell filter hook
function filter_link_cell( $formattedValue, $tableId ) { 
   if ($tableId == 7) { 
      $link = string_transform_link($formattedValue, '", $link); 
      return ""; 
    }
}

add_action( 'wpdatatables_filter_link_cell', 'filter_link_cell', 10, 2);
function string_transform_link($str, $starting_word, $ending_word)
{ 
    $subtring_start = strpos($str, $starting_word); 
    $subtring_start += strlen($starting_word); 
    $size = strpos($str, $ending_word, $subtring_start) - $subtring_start; 
    return substr($str, $subtring_start, $size);
}