php - Check if Wordpress User exists by email -
for life of me cant work (default example wp codex). created php file code , dropped in theme folder, when access file on web blank page, nada -- missing something, have put someplace else? appreciated.
<?php $email = 'myemail@example.com'; $exists = email_exists($email); if ( $exists ) echo "that e-mail registered user number " . $exists; else echo "that e-mail doesn't belong registered users on site"; ?>
simple answer, if template page, use this:
<?php $email = 'myemail@example.com'; $exists = email_exists($email); if ( $exists ) echo "that e-mail registered user number "; else echo "that e-mail doesn't belong registered users on site"; ?>
and ensure have correct opening , closing php tags.
but if other tempalte page use this:
<?php require_once("../../../../wp-load.php"); //add $email = 'myemail@example.com'; $exists = email_exists($email); if ( $exists ) echo "that e-mail registered user number "; else echo "that e-mail doesn't belong registered users on site"; ?>
add or remove ../ in require_once("../../../../wp-load.php") per page location. surely you.
Comments
Post a Comment