MySQL WordPress oprhan postmeta CleanUp

If your blog get agged probably it get slow . To clean up old SQL entrys there are several plugins but some time like in my case you need to delete millions of outdated Orphaned Post Meta  , than plugins will timeout your SQL Database.

Especially if you experiment with  post  plugins loops can cause very fast tausend of duplicated post and metas.

[divider line_type=”Small Line” line_thickness=”1″ divider_color=”default”]

This is the first try to explore and dig a bit deeper into the Developer World , not only from the code and benefit side but also to learn more about the style and thinking that build the red line thru all his work . Many times phantastic people nearly disappear online and there Blogs get abandoned . Most likely one of the Big 5 IT cooperation already hired him and no time for free plugins or Blogging .

  • Revisiones
  • Auto drafts
  • Deleted comments
  • Unapproved comments
  • Spammed comments
  • Deleted comments
  • Orphaned post meta
  • Orphaned comment meta
  • Orphaned user meta
  • Orphaned term meta
  • Orphan term relationships
  • Unused terms
  • Duplicated post meta
  • Duplicated comment meta
  • Duplicated user meta
  • Duplicated term meta
  • Transient options
  • Optimizes database tables
  • oEmbed caches in post meta
[nectar_gradient_text heading_tag=”h1″ color=”extra-color-gradient-1″ gradient_direction=”horizontal” text=”WP Sweep”]

Wp- Sweep is from the Developer Lester Chan a well known high profile WordPress Developer . The Plugin works smooth and clean following WordPress Tables and Terms as long they stay below 100.000 entry then it still works but can take extremely long and outtime your SQL Database on a shared host

The image below show the wp sweep admin screen after cleanup .

[nectar_image_with_hotspots image=”5933″ preview=”https://metaprime.at/blogapp/wp-content/uploads/2016/09/Screen-Shot-2016-09-29-at-12.53.49.jpg” color_1=”Accent-Color” hotspot_icon=”plus_sign” tooltip=”hover” tooltip_shadow=”none”][nectar_hotspot left=”96.31236442516268%” top=”37.2093023255814%” position=”top”][/nectar_hotspot][nectar_hotspot left=”11.496746203904555%” top=”41.08527131782946%” position=”top”][/nectar_hotspot][nectar_hotspot left=”13.882863340563992%” top=”13.178294573643413%” position=”top”][/nectar_hotspot][/nectar_image_with_hotspots]

MYSQL query to delete orphaned postmeta

Of course before you make any change or clean up in your database dont forget the full backup . For a faster access i use a client like Sequel Pro to manage all the Databases

<code>

DELETE pm
FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL

</code>

[image_with_animation image_url=”5938″ alignment=”center” animation=”Fade In” box_shadow=”small_depth” max_width=”100%”]

Leave a Reply

avatar
  Subscribe  
Notify of