Created
May 5, 2016 19:36
-
-
Save thomasplevy/843e949e44c6248a3040799d73da609b 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! | |
/** | |
* Add a custom field to the user's profile on the WP admin panel | |
* @param array $fields associatve array of field data | |
* @return array | |
*/ | |
function my_custom_user_fields( $fields ) { | |
$fields['llms_custom_field_id'] = array( // array key *should* the value you want to store in the WP usermeta table | |
'description' => 'A short description of this field', | |
'label' => __( 'My Custom Field Label', 'my-text-domain' ), | |
'required' => false, // if you want this field to be required, switch to "true" | |
'type' => 'text', // accepts any valid HTML5 input type, note that we don't have support for textareas or select elements! | |
); | |
return $fields; | |
} | |
add_filter( 'lifterlms_get_user_custom_fields', 'my_custom_user_fields', 10, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment