It is possible but you must manually create a new instance of the wpdb
class with right settings for your other database.
Quote from the wpdb Codex page:
The $wpdb object can talk to any number of tables, but only one
database: the WordPress database. In the rare case you need to connect
to another database, you will have to instantiate your own object from
the wpdb class with the appropriate connection details. For extremely
complicated setups with many databases, consider using hyperdb
instead.
Related Posts:
- MySQL SELECT increment counter
- Exclude Statement in SQL
- Custom form that store input in database
- Restoring WordPress posts from database only
- Can a post ID be 0?
- Issue with wp_insert_post and post_content field error Could not update post in the database
- wp_posts – guid update
- what is the wp_5_posts table in the database?
- Migrating data between local and development server
- WordPress Database Charset/Collate
- What is the database table for pages?
- Using Dynamic Data Pulled from a MySQL Table in a WordPress Page
- Meta query interfering with orderby relevance
- Why is Woocommerce writing in my wp_comment table?
- save new data to wp_options non-post form
- Error establishing a database connection when migrating site to localhost
- Strange Deadlock database error for the query “Delete From wp_options”
- Strange characters on wordpress site – Not UTF8 Issue
- WordPress showing install screen after max_questions error
- Connect to live db whilst working locally
- PHP variable in WordPress database query
- Differences between add_post_meta and update_post_meta
- Why do wordpress store pages/posts within the database instead of files? [closed]
- Insert custom data to custom table on wordpress database
- How does WordPress store data?
- Query WordPress database by registered date and role
- Tons of Twitter rows in my database
- Merging WordPress posts from different databases
- How to replace values in WordPress DB using phpMyAdmin
- How do I reset a self-hosted WordPress URL?
- Select Multiple meta_value from WP DB; Single Query
- Is it possible to split database tables using HyperDB?
- Show content from database
- Customize JSON output
- CRUD operations using WordPress database API
- How do I get WordPress login to ignore the password input if a particular username is used?
- Migrating WordPress from DreamHost to Azure WordPress Resource via UpdraftPlus “wp_options table does not exist…” error
- “Error establishing a database” connection on some sites
- change wp user status from wp_users table
- WordPress is not creating table in database after activating plugin,
- Is MariaDB’s Aria storage engine suitable for WordPress?
- Difficulty importing my live site to local
- How do I delete these post types in my WordPress database?
- Slow queries constantly getting stuck on WordPress database of ~100,000 posts
- How do I query wp_options for expired transient pairs with MySQL commands?
- WordPress returns to an old version
- Super slow queries from author archive pages killing my database
- WordPress running SQL query to update database from form
- How to fix database error duplicate entry
- How do I convert a MySQL database from utf8mb4 to utf8 encoding?
- WPDB SQL query with prepare() returning variable, not db value
- Get value form wordpress database
- Moving to another server database connection error [closed]
- Why this query is not showing any result on wordpresss home page?
- Best practice to limit results in get_row()?
- How to migrate a database from a server to another
- How to display content from external db with relevant urls
- Is there an easy way of exporting posts with their category already asigned and pictures from localhost?
- Connect to another WP install and grab post based on custom field
- Which table (and column) has the content of configured get_post_meta?
- Serialize data before inserting into the DB
- how to count click tab menu and insert to database
- Adding prefix to WordPress database tables breaks admin capabilities?
- What is the best way to resurrect and update my old WordPress site?
- content disappearing minutes after it’s published
- What is the most efficient way to reset a WordPress site?
- Add pdf to a website
- Optimizing function that automatically creates internal links based on post title string
- Outputting query results
- Help With a Large WordPress Based MySQL Database on Shared Hosting
- WordPress where clauses in db select
- How to display data from db in select list [closed]
- Can two domains use the same database?
- Native timestamp on wp_options option
- _wp_attachment_metadata is not being added to database when PDF files uploaded
- SELECT rows between two datetimes when the range is dynamic [closed]
- adding user_id and name to a separate table whenever a user register based on role
- How do I loop/iterate through posts to edit all img tags?
- error establishing a database connection 3
- User saved through WordPress backend does not show up in database table users
- How to edit posts/pages without making the change live?
- Correct and secure way to access a custom SQL database in a custom PHP template file
- How to optimise this database query?
- How to retrieve user data based on role using SQL?
- Adding featured for post using database
- Does WordPress Support Using Named Pipes on the Windows Operating System?
- get_the_terms is not working
- Store id from database query in cookie
- Split database on large site?
- Store the wordpress “featured image” under »wp_posts« Database table
- Custom metabox does not store data
- Return image urls with specific base string?
- What WordPress file is saving new users to database
- wordpress database error
- How do i get value from wp_postmeta?
- Local host to server import problem
- Link to handle $_GET request
- WordPress sync with phpbb
- featured image not showing up with mysql_connect
- SQL Query to get post_id from wp_posts and and meta_key(s) from wp_postmeta