DB table wp_postmeta has 2 mill instances

I have a site running where the database has almost 2 mill instances in wp_postmeta table with metakey: _wp_attachment_metadata
It's a relative small site, but in the image gallery it generates some strange files when uploading an image, perhaps it's here it generates all the instances in the table see attached screenshot of mediagallery.
The file mysql.sql located in wp-content/uploads are 3,7 Gb, and filling up the space on the server. Is there anyway to remove all the unused instances and find out why it generates so many files when uploading an image?

I have granted access on the site via wpmu dashboard to sirasacademy . com

  • Nastia

    Hello Johnny ,
    I trust you are doing well!

    I have seen a similar issue before. It looks more like a conflict with another plugin that creates multiple instances when an image is uploaded.

    Please deactivate all your plugins and switch to a default WordPress theme and upload an image to your site. Will you be able to replicate this issue?

    If everything is well, activate one plugin at a time to find the one that causes this.

    Follow the steps from the flowchart:

    If you still getting the same result, please enable WordPress debugging. Add the the following lines to the wp-config.php file, BEFORE /* That's all, stop editing! Happy blogging. */:

    define( 'WP_DEBUG', true );
    define( 'WP_DEBUG_LOG', true );
    define( 'WP_DEBUG_DISPLAY', false );

    Replicate the issue again. This way all errors will be saved in the debug.log file inside the /wp-content/ directory. Let us know the information you will find inside.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.