Created
December 24, 2014 00:56
-
-
Save fieldoffice/e984d4bff9ecca371dde to your computer and use it in GitHub Desktop.
WordPress SQL Queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// UPDATE POST CONTENT | |
UPDATE wp_posts SET `post_content` | |
= REPLACE (`post_content`, | |
'OriginalText', | |
'ReplacedText'); | |
// CHANGE POSTS TO PAGES | |
UPDATE wp_posts SET post_type = 'page' WHERE post_type = 'post' | |
// CHANGE PAGES TO POSTS | |
UPDATE wp_posts SET post_type = 'post' WHERE post_type = 'page' | |
// DISABLE/ENABLE PLUGINS | |
UPDATE wp_options SET option_value = 'a:0:{}' WHERE option_name = 'active_plugins'; | |
// CHANGE DEFAULT ADMIN USENAME | |
UPDATE wp_users SET user_login = 'NewUserName' WHERE user_login = 'Admin'; | |
//RESET WORDPRESS PASSWORD | |
UPDATE `wordpress`.`wp_users` SET `user_pass` = MD5('PASSWORD') WHERE `wp_users`.`user_login` =`admin` LIMIT 1; | |
// REMOVE SHORTCODES | |
UPDATE wp_post SET post_content = replace(post_content, '[shortcode]', '' ) ; | |
// DELETE POST META | |
DELETE FROM wp_postmeta WHERE meta_key = 'metakey'; | |
// BATCH DELETE SPAM COMMENTS | |
DELETE FROM wp_comments WHERE wp_comments.comment_approved = 'spam'; | |
// DISABLE COMMENTS ON OLD POSTS | |
UPDATE wp_posts SET comment_status = 'closed' WHERE post_date < '2014-12-01' AND post_status = 'publish'; | |
// BATCH DELETE POST REVISIONS | |
DELETE FROM wp_posts WHERE post_type = "revision"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment