Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save plugin-republic/ab25cfb282cee7a545661eae9a6f1381 to your computer and use it in GitHub Desktop.
Save plugin-republic/ab25cfb282cee7a545661eae9a6f1381 to your computer and use it in GitHub Desktop.
<?php
/**
* Filter our field params before they're saved
* In this case, set a calculation field with the ID 4991 to be flat rate
* @requires 3.4.3 and greater
*/
function prefix_before_update_field_all_params( $all_params, $field_id ) {
if( $field_id == 4991 ) {
$all_params['field_flatrate'] = 1;
}
return $all_params;
}
add_filter( 'pewc_before_update_field_all_params', 'prefix_before_update_field_all_params', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment