I'm new to Wordpress plugins. I've been asked to improve an existing plugin we have (make it more portable, etc). When installing the plugin and trying to use it the first thing I get is a fatal error about a missing file.
require_once( $_SERVER['DOCUMENT_ROOT'] . '/wp-load.php' );
My install is at /wp, so this immediately fails. I'm having trouble figuring out the correct way to load or initialize wordpress within my plugin to give me access to the database connection, etc. I assumed this would already be working.
From my brief searching on the topic people are recommending NOT including that file, but I haven't seen a good way to do it another way. I've tried these approaches as well.
This fails since ABSPATH is not yet defined.
require_once( ABSPATH . '/wp-load.php' );
This fails since it's not yet defined.
get_home_path()
I'm using the latest version and a clean install. The plugin I'm working with is probably a year or two old at least.
Any help would be great.