Hello I am new to WordPress and PHP and I am trying to delete an user in a function in a plugin.
wp_delete_user( $user->ID );
Everything is working well but when I try to use wp_delete_user i get the following error:
Call to undefined function wp_delete_user() in /homepages/6/d480314532/htdocs/wsb7416187601/zisteau_web/wp-content/plugins/patreon-wordpress-master/classes/patreon_wordpress.php on line 135
This function is located in wp-includes/user.php. Are there any way to import this funtionality to use it there?
Thanks.
At first, please ask WP questions at:
WordPress.Stackexchange.com
p.s.: before that line insert:
I found this in a Google search and wanted to add this for anyone looking for a solution when using WordPress multisite. Instead of loading wp-admin/includes/user.php, you’ll need to load wp-admin/includes/ms.php like:
require_once( ABSPATH . 'wp-admin/includes/ms.php' );