Last active
December 31, 2015 09:09
-
-
Save ryanfitton/7965119 to your computer and use it in GitHub Desktop.
Get a users Bio Description whose email address is the same for what is set in WordPress' Administration within General Settings
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
<p><?php echo wpAdminEmailUserBio(); ?></p> |
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 | |
//Get the Bio of the user whose email address is used for Admin Purposes in 'General Settings' | |
function wpAdminEmailUserBio() { | |
//Find the standard user whose email address is the same as WordPress' general settings administration email address | |
$findUser = get_user_by('email', get_bloginfo('admin_email')); | |
//Check if a user could be found | |
if ($findUser) { | |
//If true then get the Bio from the persons User ID and store it to a variable | |
$bio = get_the_author_meta('description', $findUser->id); | |
} else { | |
//If false then set an error message to a variable | |
$bio = "No user could be found whose email address matches the admin email address set within WordPress General Settings"; | |
} | |
//Return results when function is called | |
return $bio; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment