通过电子邮件检查Wordpress用户是否存在

For the life of me I cant get this to work (default example from WP Codex). I created a php file with this code and dropped it in my theme folder, when I access the file on the web I get a blank page, nada -- am I missing something, do i have to put this someplace else? any help is greatly appreciated.

  <?php
  $email = 'myemail@example.com';
  $exists = email_exists($email);
  if ( $exists )
  echo "That E-mail is registered to user number " . $exists;
  else
  echo "That E-mail doesn't belong to any registered users on this site";
  ?>

Try to add wp-load.php in your file with right path.

<?php
  require_once("../../../wp-load.php");  //ADD THIS

  $email = 'myemail@example.com';
  $exists = email_exists($email);
  if ( $exists )
  echo "That E-mail is registered to user number " . $exists;
  else
  echo "That E-mail doesn't belong to any registered users on this site";
  ?>

simple answer, If that is the template page, than use this:

<?php
  $email = 'myemail@example.com';
  $exists = email_exists($email);
  if ( $exists )
  echo "That E-mail is registered to user number ";
  else
  echo "That E-mail doesn't belong to any registered users on this site";
  ?>

and ensure you have correct opening and closing php tags.

But if are from other than tempalte page then use this:

<?php
  require_once("../../../../wp-load.php");  //ADD THIS

  $email = 'myemail@example.com';
  $exists = email_exists($email);
  if ( $exists )
  echo "That E-mail is registered to user number ";
  else
  echo "That E-mail doesn't belong to any registered users on this site";
  ?>

Add or Remove ../ in the require_once("../../../../wp-load.php") as per the page location. This will surely help you.