{"id":246,"date":"2024-10-05T01:59:30","date_gmt":"2024-10-04T17:59:30","guid":{"rendered":"https:\/\/gri.my\/blog\/?p=246"},"modified":"2024-10-05T01:59:30","modified_gmt":"2024-10-04T17:59:30","slug":"delete-all-product-images-from-magento-store","status":"publish","type":"post","link":"https:\/\/gri.my\/blog\/delete-all-product-images-from-magento-store\/","title":{"rendered":"Delete all product images from Magento store"},"content":{"rendered":"\n<p>It all boils down to:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Nuking the database<\/h3>\n\n\n\n<p>In your mariadb instance, execute<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: sql; title: ; notranslate\" title=\"\">\ntruncate catalog_product_entity_media_gallery_value;\ntruncate catalog_product_entity_media_gallery_value_to_entity;\ndelete from catalog_product_entity_media_gallery;\ndelete from catalog_product_entity_varchar where attribute_id in ( select \n     attribute_id from eav_attribute where attribute_code IN ( &#039;image&#039;, &#039;small_image&#039;, &#039;thumbnail&#039;, &#039;swatch_image&#039;, &#039;media_gallery&#039; ) AND entity_type_id = 4 );\n<\/pre><\/div>\n\n\n<h3 class=\"wp-block-heading\">2. Nuking the media folder<\/h3>\n\n\n\n<p>In your Magento instance, execute<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\nrm -rf pub\/media\/catalog\/product\n<\/pre><\/div>\n\n\n<p>There, clean slate for you to populate.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It all boils down to: 1. Nuking the database In your mariadb instance, execute 2. Nuking the media folder In your Magento instance, execute There, clean slate for you to populate.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-246","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/posts\/246","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/comments?post=246"}],"version-history":[{"count":5,"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/posts\/246\/revisions"}],"predecessor-version":[{"id":251,"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/posts\/246\/revisions\/251"}],"wp:attachment":[{"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/media?parent=246"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/categories?post=246"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gri.my\/blog\/wp-json\/wp\/v2\/tags?post=246"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}