0
votes

000 "_wp_attachment_metadata" in mySQL for about 50k images on my blog and it's slowing down my WP site significantly.

I've checked the field and found it contain almost nothing significant .. most looked like blanks.

Example:

a:5:{s:5:"width";i:500;s:6:"height";i:750;s:4:"file";s:21:"2013/10/698-thumb.jpg";s:5:"sizes";a:2:{s:9:"thumbnail";a:4:{s:4:"file";s:21:"698-thumb-150x150.jpg";s:5:"width";i:150;s:6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:21:"698-thumb-200x300.jpg";s:5:"width";i:200;s:6:"height";i:300;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_meta";a:10:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:"caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:12:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";s:0:"";}}

Hence I want to either

  • remove them
  • remove the values
  • trim down string

But I am not sure how .. and also how to do it. Hope someone can help me with this.

Thanks in advance :)

1

1 Answers

0
votes
<?php delete_post_meta_by_key( '_wp_attachment_metadata' ); ?>

Delete all the meta data with the specific key