I am trying to check if a username is available in wordpress by using ajax with a php script backend, however am unsure of how to do this correctly.
In the checkusername.php
script, I include WordPress's user.php
like so:
require_once("../wp-includes/user.php");
I call username_exists( $_POST["username"] )
and am greeted with the following error:
Call to undefined function get_user_by() in ...\user.php on line 1613
Note I abbreviated the location. If I include pluggable.php
I get a similar error but for
Class 'WP_User' not found in ...\pluggable.php on line 152
Honestly I don't really know how I am supposed to be correctly utilizing the user.php file outside of wordpress pagetemplates so if someone could help me that would be great.