Yes, you can use the query
function to rename tables.
global $wpdb;
$oldTable = $wpdb->prefix . "wpfd_docs";
$newTable = $wpdb->prefix . "ccdm_docs";
$renameOk = $wpdb->query("RENAME TABLE " . $oldTable . " TO " . $newTable);
if( $renameOk )
{
echo 'All good';
}else{
echo 'Failed to rename table. Last DB error: ' . $wpdb->last_error;
}
Related Posts:
- Difference between partition key, composite key and clustering key in Cassandra?
- How SID is different from Service name in Oracle tnsnames.ora
- What is a relation in database terminology?
- Why WordPress choose data serialization over json_encode?
- Relaunch 4.2 utf8mb4 database upgrade
- Are There Any Plans for WordPress to Support Databases Other Than MySQL?
- Reset Post IDs to less than 64bit integer
- Where can I find the database changes between WordPress versions?
- how can get database name in wordpress?
- Does WordPress use the InnoDB engine for MySQL by default?
- $wpdb->prepare() warning in WordPress 3.5
- When is it appropriate to create a new table in the WordPress database?
- Best way to import users, post and categories from an external database
- Performance tips for a large user base [closed]
- How to delete outdated, wrongly sized images in _wp_attachment_metadata?
- wp_options is GB in size
- Can’t update database after wordpress update from 3.8.1 to 4.4.1
- $wpdb variable throw this error Call to a member function get_results() on a non-object in
- Extend the wp_users table
- Why does WordPress rely on an fully qualified site_url with a 15-step plan for moving a site?
- I have a problem with my WordPress DB after I tried to install multi-site
- Database sync between local and production
- WordPress and automated MySQL backups to a different host
- Database error Deadlock found when trying to get lock; try restarting
- Connect Second Database to WordPress
- update_user_meta() does not work
- Query from a different database than the default
- How can I create a Bible search engine via WordPress? [closed]
- Error establishing a database connection; After importing DB & Theme
- Check if column exists for one table in DB
- Get all images from this database table
- Delete transients in website
- wp_get_current_user always returns 0 continued
- Bulk-create posts from SQL database
- Allow logged in users to store and display some data
- Replace/Mute/Stop Search Query
- I am switching laptops. I host my WP server through MAMP. I want to transfer [closed]
- How can i customize the export personal data file?
- How to merge two WordPress databases with the same structure?
- Auto login subdomain from main domain on single sites with different DB
- Logins from WP users table use on another page
- How to prevent/delay MySQL connections when an object cache is used?
- Error establishing a database connection problem in xampp saver
- I’m not able to get access to $wpdb [duplicate]
- “Error establishing a database connection” – Intermittent error on GoDaddy
- Importing Direct to DB – GUID Question
- WordPress database connection [closed]
- Changing between Local Host DB to Production DB and in reverse
- WordPress site to be able to connect with data on local machine of user
- Bulk Updating Post Date in 1 day Increments
- Query Column of Specific ID from Database Table
- Posting variables to WP database using $_POST method
- Debugging – logging database queries
- Link image with data from the wpdb
- Update multiple rows in one query
- How to direct my site to the proper URL without Dashboard
- SELECT SQL_CALC_FOUND_ROWS with wordpress search
- Understanding WordPress Search
- access JSON results from wordpress database with wpdb
- How to add checkbox with multiple values in table?
- contact form-7 drop downs not populating database [closed]
- Cloning blog to localhost via WAMP
- wpdb Insert unknown post data dynamic foreach loop
- How do I use a database in a custom theme?
- Deleting empty meta key values
- I imported an restore an database and It shows #1067 – Invalid default value for ‘user_registered’
- WP 5.5, child themes, customizer and a weird cache issue
- Migrating meta_key and meta_value from old theme to new one
- How do you enable scripts on a WordPress installation in Softaculous?
- How to rerieve comments and their replies from DB
- Inserting data with Geometry field
- Best way to store 1 billion+ posts?
- Export only a part of the database for migration
- Why am I being prompted to reinstall wordpress?
- What’s the easiest way to connect external database and display data on wordpress?
- database error WordPress move from one hosting to other
- Character encoding issue – black diamond question marks on imported post excerpts
- Select data from foreach loop and send it to wordpress database
- Error establishing database connection error during first WordPress run
- Same DB for live and dev versions
- update multiple user meta field based on another meta field
- After renaming MySQL database, I can no longer access my Blog page
- Reinstall wordpress/mySQL caused database problem
- execute custom function on database connection error
- Call to a member function insert()
- Create a new table on the database and save parameters from a contact form
- not saving post in wp_post wordpress database table
- How to have WP Search widget index dynamically generated content?
- Preventing concurrent update of data
- How to add data from wordpress tables to new database tables you have created
- Creating Tables in WordPress Database
- Calling update_user_meta inside of another function doesn’t work
- How to back-up a database on IIS
- $wpdb->prepare returns empty array
- Prevent creation of unused database tables?
- How to store a plain password in WordPress database in another field
- Where are database files of a WordPress website?
- How can i change the nicename and the displayname in a bulk in the database?
- cannot access wp-admin after options table crash and repair
- How to update multiple row by one query