Useful WordPress SQL queries

I am now two years full time busy with WordPress development and I have learned that it is very convenient to use SQL Queries. Below I have compiled a list of useful WordPress SQL Database Queries. I hope it’s useful for you!

Change post_type name for other name

update wp_posts SET post_type = 'newcptname' where post_type like 'oldcptname'

Change WordPress base / home URL

UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';

Change default Admin username

UPDATE wp_users SET user_login = 'Your New Username' WHERE user_login = 'Admin';

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s