Skip to content

Instantly share code, notes, and snippets.

@bolderelements
Last active October 10, 2020 20:27
Show Gist options
  • Save bolderelements/52ced3e2f392267ccb94c462c5ec1ebc to your computer and use it in GitHub Desktop.
Save bolderelements/52ced3e2f392267ccb94c462c5ec1ebc to your computer and use it in GitHub Desktop.
Save form field from custom column in the Table of Rates
/**
* Save form field from custom column in the Table of Rates
*
* @return string
*/
function betrs_save_column_data( $save_data, $option_ID, $row_ID ) {
// sanitize arguments
$option_ID = intval( $option_ID );
$row_ID = intval( $row_ID );
// get selected value
$selection = ( isset( $_POST['provider'][ $option_ID ][ $row_ID ] ) ) ? sanitize_text_field( $_POST['provider'][ $option_ID ][ $row_ID ] ) : '';
// add value to saved data array
$save_data['provider'] = $selection;
return $save_data;
}
add_filter( 'betrs_shipping_table_save_row', 'betrs_save_column_data', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment