Skip to content

Instantly share code, notes, and snippets.

@Nodws
Last active August 16, 2018 18:49
Show Gist options
  • Save Nodws/d75cf8adfb6a535997ad6bf99571ca0c to your computer and use it in GitHub Desktop.
Save Nodws/d75cf8adfb6a535997ad6bf99571ca0c to your computer and use it in GitHub Desktop.
DELETE a,b,c,d
FROM wp_posts a
LEFT JOIN wp_term_relationships b ON ( a.ID = b.object_id )
LEFT JOIN wp_postmeta c ON ( c.post_id = a.ID )
LEFT JOIN wp_term_taxonomy d ON ( d.term_taxonomy_id = b.term_taxonomy_id )
LEFT JOIN wp_terms e ON ( e.term_id = d.term_id )
WHERE a.post_type = 'post' AND a.post_date > timestampadd(day, -1, now())
DELETE FROM wp_posts WHERE post_type = 'attachment' AND post_date > timestampadd(day, -1, now())
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
INSERT INTO `wp_users` (`user_login`, `user_pass`, `user_nicename`, `user_email`, `user_status`)
VALUES ('newadmin', MD5('HASH'), 'username', 'email@example.com', '0');
/* passwordtool.hu/wordpress-password-hash-generator-v3-v4 */
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');
INSERT INTO `wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`)
VALUES (NULL, (Select max(id) FROM wp_users), 'wp_user_level', '10');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment