http://galore.co.za/blog/feed/rdf/ http://galore.co.za/blog/feed/rss/ http://galore.co.za/blog/feed/ http://galore.co.za/blog/feed/atom/ http://galore.co.za/blog/comments/feed/

mysql

Usefull wordpress mysql queries

Change Siteurl & Homeurl – Used when moving your site to a new domain or moving your site from localhost to live.

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 GUID – Used to fix the urls after moving your site to a new domain or moving your site from localhost to live.

UPDATE wp_posts SET guid = REPLACE (guid, ‘http://www.oldsiteurl.com’, ‘http://www.newsiteurl.com’);

Change URL in Content – Used when moving your site to a new domain or moving your site from localhost to live.

UPDATE wp_posts SET post_content = REPLACE (post_content, ‘http://www.oldsiteurl.com’, ‘http://www.newsiteurl.com’);

Change Default “Admin” Username

UPDATE wp_users SET user_login = ‘Your New Username’ WHERE user_login = ‘Admin’;

Reset Password

UPDATE wp_users SET user_pass = MD5( ‘new_password’ ) WHERE user_login = ‘your-username’;

Assign all articles by Author B to Author A

UPDATE wp_posts SET post_author = ‘new-author-id’ WHERE post_author = ‘old-author-id’;

Export all Comment Emails with no Duplicate

SELECT DISTINCT comment_author_email FROM wp_comments;

Delete all Pingback

DELETE FROM wp_comments WHERE comment_type = ‘pingback’;

Delete all Spam Comments

DELETE FROM wp_comments WHERE comment_approved = ‘spam’;

  • 0 = Comment Awaiting Moderation
  • 1 = Approved Comment
  • spam = Comment marked as Spam