My issue was resolved, not sure if the connection to the database will work, but the error with wpdb connection was fixed. It was quite easy fix once I found out what the file dependence was. This is what you need to do:
In the file you are trying to use wpdb you need to add code before you can use the class:
<?php require_once('../../../wp-load.php'); ?>
Note* You may need to change how far back in the directory you go depending on your install or depending on the location of your php template/file.
It should run wpdb without any errors.
Related Posts:
- How to insert a single row to WP database table?
- Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- How to return number of found rows from SELECT query
- $wpdb->delete column values IN ARRAY()?
- WPDB: how to get the value of a field in a custom database table
- Prevent Data Resubmission On Page refresh
- Any possible way to make $wpdb->get_results() return anything else than array?
- database interactions using OOP
- Display fields as values in array from external SQL DB
- Getting id of poll from WP database
- WSoD being caused by this piece of code
- $wpdb->update with multiple parameters gives error
- Update results, Before deleting the related category [closed]
- How WordPress reacts to a lack of memory of the server [closed]
- Display Data in Table from External Database in WP using Shortcodes
- How to retrieve the data from the sever and displaying it in a page?
- I can’t update my data through $wpdb
- wpdb Cannot Update column in Database
- How to use mysql LIKE with wpdb?
- Delete database record using plugin from admin panel
- Wpdb get->results to out the the month from the db
- How to add data to a custom field at the wp_users table?
- Change MySQL PDO connection to a WPDB connection
- WPDB – Read and write value from / to database
- How to Generate a list of Most Commented post?
- Add row to custom database Table and delete all rows older than 1 day
- select a single val though a table in wordpress
- SQL error with custom query
- Add posts to custom table in database instead of wp_posts
- Isn’t Returning Value While Using SELECT COUNT(*) FROM {$wpdb->prefix}
- Database entry removed on browser refresh, Ajax PHP jQuery
- Change wordpress’ database data using ajax – how to get current user id?
- Create a new account on site B with data from the purchase of site A
- Using wpdb to connect to a different database is not working
- Modify post image in full size
- How to grab data from input and store it into custom table in database?
- Accessing external database: ERR_INCOMPLETE_CHUNKED_ENCODING
- Weird Behaviour: Not all WordPress Posts appearing
- How to fetch results from database
- Check if values exists DB
- Querying multiple meta_keys in WordPress SQL query
- MySQL database migration to WordPress
- Fetching wpdb data from a php file seems to break?
- Insert into db with foreach problem
- posts_clauses drop ACF get_field function
- How to get data (not value or name) from radio options to POST to database
- Putting form result in my database
- Fatal error: Call to undefined function plugin_dir_path()
- Switching wp_get_sites to get_sites
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- WP API V2 returning Invalid User ID
- One button to change all settings in theme customizer?
- How can update custom meta for all posts
- Can’t use get_results() in ajax query
- Is $hook a global variable in WordPress
- Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- WordPress get pagination on wpdb get_results
- How do I fetch all comments per post via WP REST API?
- wp_insert_post not working
- Shortcode content output but not in correct place
- Handling Body class based on Template
- How to output a PHP file values by shortcode?
- Logged in user ID as post ID
- 3 Slashes appear after Apostrophe in custom fields after updating product-site
- Copyright info change – Corporate Plus Theme PHP [closed]
- Inject class in body when particular page template is used
- How to list posts from a plugin taxonomy?
- first instantiated SimplePie object cosumes 5mb?
- Theme not calling Jquery properly
- Creating Database Table vs. Adding MetaData to Post & User
- WordPress redirect redirecting too many times or not at all
- If Array Values Match Another Array’s Values, Then
- Open and closed function [closed]
- Need to Modify a WordPress Shortcode with another wordpress shortcode
- WPDB secure custom form
- Insert content into head tag with function
- Remove role of user after X days
- User filter posts by year
- bp-custom.php is not working on a WordPress multisite environment. how to fix it?
- Adding wp users ID into a link address from a DIVI modul
- Execute function only for specific user roles
- Limit Search to Product Pages only unless I’m on Blogpage or Blogposts
- WP query posts BUT show the most recent and one per author
- Block error message in foreach loop when looping through ACF field
- Include User ID in iFrame URL
- Outputting post content to jQuery .html() string
- shortcodes, custom php and their errors
- In a foreach loop, how can I add a meta value if it doesn’t exist?
- 403 Forbidden WordPress Database Results
- Remove node from multisites?
- How to add custom text near category/tag title in WordPress Twenty Fifteen Theme?
- How do I get the featured post to share on Social Media and show on Individual Post pages?
- Echo multiple tasks if a common function exists
- A Customizer checkbox control that sets the setting to “” or to “blank” and show() or hide() a color control
- Issues separating my Plugin pages into different files
- SQL – How to echo out inside of where statement
- How can I update a value of a field depending on outside source?
- Tags being Inserted in html from plugin PHP not passing through the_content
- Add/Modify rel=canonical of all the pages of a wordpress website
- Calling a PHP function from a menu item