Use wp-config.php constants in all files of plugin
A Bigger Note on Database Access You shouldn’t be using the database constants. Instead you should be using the WPDB class, e.g. global $wpdb; $results = $wpdb->get_results( ‘SELECT * FROM wp_options WHERE option_id = 1’, OBJECT ); That still leaves you with the issue that you need to be inside a WP context though, but … Read more