Last active
October 10, 2020 20:27
-
-
Save bolderelements/52ced3e2f392267ccb94c462c5ec1ebc to your computer and use it in GitHub Desktop.
Save form field from custom column in the Table of Rates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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