Created
May 5, 2016 20:33
-
-
Save thomasplevy/52e4e5aa3f619e4e3ca8ea2ec4937c62 to your computer and use it in GitHub Desktop.
This file contains 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
<?php // don't copy this line into your functions.php file! | |
/** | |
* Customize the value stored in the database before the field data is saved | |
* | |
* This runs after validation so no need to re-validate here | |
* | |
* @param mixed $value user submitted value | |
* @param obj $user WP_User instance | |
* @param string $field_id name / id of the field | |
* @return mixed | |
*/ | |
function my_custom_field_save( $value, $user, $field_id ) { | |
// for example ensure remove protocal prefixes from the beginning of a web address field | |
$value = str_replace( array( 'https://', 'http://' ), '', $value ); | |
return $value; | |
} | |
add_filter( 'lifterlms_save_custom_user_field_my_custom_field_id', 'my_custom_field_save', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment