Skip to content
  • Home
  • News
  • Contact
  • Privacy Policy

Maintaining a WordPress Database

This is a quick example for maintaining a MySQL WordPress database. Use with caution! Only if you know what you are doing! You may use these commands in phpmyadmin if you have access. Replace “loc” with your database table prefix (which is usually “wp”)


/* deleting orphaned post meta */
DELETE loc_postmeta FROM loc_postmeta WHERE NOT EXISTS ( SELECT * FROM loc_posts WHERE loc_postmeta.post_id = loc_posts.ID )
/* deleting particular post meta */
DELETE loc_postmeta FROM loc_postmeta WHERE loc_postmeta.meta_key = "meta-checkbox"
DELETE loc_posts FROM loc_posts WHERE loc_posts.post_title = "Auto Draft"
DELETE loc_postmeta FROM loc_postmeta WHERE loc_postmeta.meta_key = "_edit_lock" OR loc_postmeta.meta_key = "_edit_last"
Full Service Content Rendering Machine!
  • LICENSED drone pilot!
  • Photography! Gimbals!
  • Mixed Audio!!
  • WordPress Expert!
  • PHP coding!
  • JavaScript coding!
  • CSS! & development with SASS!!
  • Custom Themes & Plugins From Scratch!