Skip to content

Instantly share code, notes, and snippets.

@macariojames
Created August 27, 2018 18:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macariojames/f4562f94848d8fe72dcea321c7ac795b to your computer and use it in GitHub Desktop.
Save macariojames/f4562f94848d8fe72dcea321c7ac795b to your computer and use it in GitHub Desktop.
SQL to change default WordPress tables (wp_ to wp_customname_)
RENAME table `wp_commentmeta` TO `wp_localapi_commentmeta`;
RENAME table `wp_comments` TO `wp_localapi_comments`;
RENAME table `wp_links` TO `wp_localapi_links`;
RENAME table `wp_options` TO `wp_localapi_options`;
RENAME table `wp_postmeta` TO `wp_localapi_postmeta`;
RENAME table `wp_posts` TO `wp_localapi_posts`;
RENAME table `wp_terms` TO `wp_localapi_terms`;
RENAME table `wp_termmeta` TO `wp_localapi_termmeta`;
RENAME table `wp_term_relationships` TO `wp_localapi_term_relationships`;
RENAME table `wp_term_taxonomy` TO `wp_localapi_term_taxonomy`;
RENAME table `wp_usermeta` TO `wp_localapi_usermeta`;
RENAME table `wp_users` TO `wp_localapi_users`;
# Then do the bottom lines, one at a time to go through the returned results and edit the fields
# SELECT * FROM `wp_localapi_options` WHERE `option_name` LIKE '%wp_%';
# SELECT * FROM `wp_localapi_usermeta` WHERE `meta_key` LIKE '%wp_%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment