WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to use wp_delete_user() in my theme, to allow a user to delete their account from the front-end.

Turns out that the wp_delete_user() is not defined unless /wp-admin/includes/user.php has been included.

Is there a right way to do this in WordPress? Something that uses get_bloginfo() or a global constant for example?

share|improve this question
Please describe your project in more detail and explain the context. My gut reaction is that there is no right way to include admin files in the theme and that you should probably be using some other approach-- possibly the AJAX API. – s_ha_dum Oct 1 '13 at 15:45
up vote 2 down vote accepted

You need to add require_once statement at the beginning of your functions.php file:

require_once ABSPATH . 'wp-admin/includes/user.php';
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.