I found the answer my self. First open your wp-config.php
and check the bottom of file that Is that contain the below code?…
if ( !defined('ABSPATH') )
define('ABSPATH', dirname(__FILE__) . "https://wordpress.stackexchange.com/");
If yes then add the below code to make the connection in your plugin PHP files to connect with wp-config.php
file that contain Database Name, Database UserName, Database Password, Database Host… …
require_once(ABSPATH . 'wp-config.php');
$connection = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD);
mysqli_select_db($connection, DB_NAME);
And you will get connection to WordPress database…
Related Posts:
- No wp-config.php file on local install of wordpress – site still displays
- Insert double entry in DB
- 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 implement WP_List_Table? WP_List_Table giving array instead of a value in listing table
- 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
- 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)?
- Accessing data from a non-WP database/table within a page content
- 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]
- Sum the total amount of a specific product purchased per user and display in table
- 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
- Not connecting to database in file with multiple MySQL connections
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- 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
- I changed the password for the database user of my website, updated wp-config.php and wordpress asks to be reinstalled
- 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
- 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 get value from URL
- Export User Info to CSV from Front End
- WordPress admin never finishes saving page on site with large page count
- Delete post revisions on post publish
- Update some database fields when post is saved
- sql query to put quotes around numbers in img tag
- How to write one comment and publish on every post using database or plugin?
- Strange wordpress slowness
- Setting All Drafts to ‘exclude-from-catalog’ in WooCommerce
- database interactions using OOP
- Execute long and heavy processes
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Databases – Submitting data from inputs to database [closed]
- WordPress Custom SQL Table with UserID Filter for results
- Why does changing Database Table Prefixes result in loss of content?
- How to get image from url from the database?
- How to use AJAX in WordPress in MYSQL query?
- MySQL Query Returns Array () In Shortcode
- Passing in MySQL prepare statement parameter separately throwing error
- Database SQL query error
- Cant create table on plugin activation
- MYSQL TIMESTAMP when adding DATE_FORMAT then the output is blank, PHP conflict?
- Updated Php version from 5.4 to 7.2 and getting “PHP installation missing the MySQL extension needed by WordPress”
- Retrieving and Displaying Data From a Table
- Moving a few select DB tables to a new WP instance
- Need help with format of nested array in MySQL
- Updating the database after parsing CSV document
- Advanced WordPress SQL Query
- Splash pages on a high traffic site
- Submit cf7 form to cfdb as pdf/BLOB [closed]
- save array of objects with update_option