WordPress SQL Snippets

Batch Deleting Spam Comments

 DELETE FROM wp_comments WHERE wp_comments.comment_approved = 'spam'; 

Batch Deleting All Unapproved Comments

 DELETE FROM wp_comments WHERE comment_approved = 0 

Disable Comments on Older Posts (edit date)

 UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2012-01-01' AND post_status = 'publish'; 

Batch Deleting Post Revisions

 DELETE FROM wp_posts WHERE post_type = "revision"; 

Delete Post Meta

DELETE FROM wp_postmeta WHERE meta_key = 'YourMetaKey';

Changing the URL of Images

 UPDATE wp_posts
SET post_content = REPLACE (post_content, 'src=”http://www.oldurl.com', 'src=”http://www.newurl.com'); 

Geef een antwoord

Het e-mailadres wordt niet gepubliceerd.