What is the right way to include a wp-admin file in your theme?

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.

Read More

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

Related posts

1 comment

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

    require_once ABSPATH . 'wp-admin/includes/user.php';
    

Comments are closed.