I have created custom php file inside template directory with the name confirm_email.php in which user's status is updating when user click on confirmation link sent to users email. but when i am using wp_update_user() to update user_status from 0 to 1. But it is returning Http 500 internal server error.


$url= $temp_dir."/confirm_email.php?id=".$_REQUEST['id']."&key=".$_REQUEST['key']."&type=return";

$user_id = wp_update_user( array( 'ID' => $_REQUEST['id'], 'user_status' => 1) );

if ( is_wp_error( $user_id ) ) {
    // There was an error, probably that user doesn't exist.
    echo "Error is here";

} else {
    // Success!
    echo "User Email confirm";



    Click on below link to confirm your email;

    $subject="Email confirmation Link";
    $headers = "From: wordpress@property-penang.com" . "\r\n";

     echo "1";  
         echo "0";
  • Are you trying to load confirm_email.php directly? Then you're using WordPress functions despite not loading WordPress. You should handle this functionality through hooks, not its own file. – Jacob Peattie May 12 '18 at 10:27
  • Surely if you turn on PHP Debugging it will give you a more specific error to go off of. – Howdy_McGee May 12 '18 at 19:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.