Last active
July 26, 2021 11:29
-
-
Save wpscholar/1224069 to your computer and use it in GitHub Desktop.
Add additional contact methods to a WordPress user profile
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
<?php | |
/** | |
* Add additional contact methods to a WordPress user profile | |
*/ | |
function more_contactmethods( $contactmethods ) { | |
$contactmethods['twitter'] = 'Twitter username'; | |
$contactmethods['facebook'] = 'Facebook URL'; | |
return $contactmethods; | |
} | |
add_filter( 'user_contactmethods', 'more_contactmethods' ); |
how can i add check box ???
Why this gives warning when I check this with "Theme check" wp plugin.
REQUIRED: The theme uses the user_contactmethods
filter, which is plugin-territory functionality.
@ayoubkhan558 It sounds like you added it to the theme. The best practice would be to add it to a plugin. The reason is if we code it into the the theme and then a user switches themes, they lose that functionality. A theme should really just impact the look and feel of a site.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How can the new contactmethod be updated/accessed? Other than the Users Pannel?