I am using a jQuery tokenizing autocomplete text entry (http://loopj.com/jquery-tokeninput) in a Wordpress form. This type of input calls a PHP script on the server (not a function) to build a list of choices from which the user may choose after the user has entered some text in the input box (very similar to your Tags input in this page). My script is located in a plugin directory on my site. I declared
but am getting a null result when I try an use its methods (like $wpdb->prefix). Clearly, Wordpress is not loaded for my PHP script. I tried adding
include('http://where2bwho2c.dev/wp-config.php'); include('http://where2bwho2c.dev/wp-load.php'); include('http://where2bwho2c.dev/wp-includes/wp-db.php');
to my script, but this had no effect. What do I need to do to make sure Wordpress is loaded in my PHP script so I can use $wpdb?
I looked at a previous question (https://stackoverflow.com/questions/42288109/wpdb-is-null-despite-being-global) but it was not clear what exactly I should do in this case where my script is not a function.