When you include wp-load.php
, WordPress will load wp-config.php
, where constants with the same identifiers you have chosen here are already defined. This should be throwing warnings regarding the duplicate definition.
Because you cannot re-define constants, the values you are attempting to set in this file are ignored. Choose different names for them if they are referring to values for your non-WordPress database.
To interact with the WordPress database, it would make more sense to use the WordPress APIs. There’s not really a good reason to establish a separate connection when you have already loaded the WordPress environment.
Related Posts:
- How to return number of found rows from SELECT query
- Check if post of title already exists
- $wpdb->delete column values IN ARRAY()?
- How To Make Connection To WordPress Data Base In A Plugin?
- Changing user_nicename
- Does WordPress cache get_user_meta() results?
- WordPress will not operate correctly
- How to Join two tables from separate databases within WordPress
- error importing localhost export file to server
- Would manually deleting the dumping data fix a “#1062 – Duplicate entry ‘1’ for key ‘PRIMARY'” phpMyAdmin error?
- How to sort results from a custom database table
- How can I call a row of user specific data from a custom table added to the WP Database
- How to merge local and live databases?
- How to track a users progress through pages by inserting data into WordPress Database?
- Import 10,000 Users into WordPress WITH a specific ID for each user
- WP database error for comments_popup_link()
- if statement on database query
- Unusable menus and “Illegal widget setting ID: nav_menu_item[]” error
- No wp-config.php file on local install of wordpress – site still displays
- How to migrate the posts from an old custom legacy blog to a new WordPress website?
- Different database query in function.php using mysqli
- How to create and work with custom data / tables (i.e., for arbitrary data)?
- Create WP_Query to search for posts by their categories or their parent/child categories
- WordPress not reflecting changed of the database
- How can I save unique user data on my site? [closed]
- Update results, Before deleting the related category [closed]
- database sent to a JSON file
- inserting a post from an extern php file but post content doesn’t show on wp site
- Using custom tables for old posts
- WordPress Block developer from exporting Database via PHP
- wpdb prepare insert table doesn’t work
- Should I use WordPress to skin a database website?
- How do I display offsite database info on my wordpress site?
- Creating Database Table vs. Adding MetaData to Post & User
- WordPress and MySQL: trying to print data using PHP from user_meta custom field data
- Most commented posts by time period (last 12h, last 24h and etc)
- I can’t update my data through $wpdb
- Why when I create a new post I found 2 record related to this post into the posts database table?
- Adding data to custom wordpress database table
- phpMyAdmin error #1062 – Duplicate entry ‘1’ for key ‘PRIMARY’
- 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
- What’s wrong in my PHP code? I’m using WordPress Astra Theme and I can’t insert data into my SQL
- Please help! I have a problem with getting wordpress databas
- Error establishing a database connection (Set-up locally)
- PHP Warning: mysqli_query(): after updating my websites php from 5.6 to 7.2
- Using wpdb to connect to a different database is not working
- Insert data from form to database
- can’t delete a row from post_meta table
- How to set max users to 17.000
- two wordpress sites, two themes, one database, same content
- Insert double entry in DB
- How to connect database table to each registered wordpress user.
- Let users register weight each day and save it in DB
- MySQL database migration to WordPress
- Custom query_posts() parameter
- How to pass username into form that sends data to database
- How to edit the default database of WordPress [closed]
- Display total count of products in orders of a specific order status
- Execute multiple PHP Snippets causes error?
- Custom form that stores data in mysql database
- Putting form result in my database
- Can’t insert into a database wordpress
- How do I make an HTML table from a database table?
- dbDelta support for FOREIGN KEY
- How to correctly submit a search form and display the result in an independent page
- Using Echo in ShortCode – Stuck
- Use ajax to update_post_meta
- Issue with foreach on duplicate meta_key’s
- What SQL / WordPress queries would need a nonce?
- Adding custom tables to WordPress
- How to securely provide a $_POST var in WP_Query with PHP 7?
- WSoD being caused by this piece of code
- How WordPress reacts to a lack of memory of the server [closed]
- Replacing mysql_escape_string in a custom plugin when moving to PHP7
- $wpdb->insert() does not Insert record in a table
- WordPress SQL injection
- Display Data in Table from External Database in WP using Shortcodes
- Lost in trying to create user database system
- Using wordpress function to retrieve data
- form $_post action value gets truncated after it passes through two forms
- making php value numeric
- Using PHP Code Snippets to query a database, $dbconnection->get_results is outputting nothing
- How to run complex query using PHP
- WordPress mysql deos not work with php7
- Error inserting into custom table – Object of class wpdb could not be converted to string [closed]
- The plugin generated 225 characters of unexpected output during activation
- How do I fetch a data from an external database into my wordpress homepage
- WordPress select query issue
- Add two or multiple functions in WordPress Post or Page
- direct query to post_meta table
- special characters not supporting in wordpress
- Unserializeing multiple column values that are stored in one database results variable
- Best way to define a database with product codes and back-end support?
- Querying multiple meta_keys in WordPress SQL query
- Trying to post information from a remote database to wordpress page
- Cannot Upload Custom Header Image into WordPress Dashboard
- PHP Call to External Database
- Predefine Magazine Style Layouts