I need to export all products and images but I don’t know which table the images are in

All images is stored in the wp_posts table with a post_type set to attachment e.g: SELECT ID, post_type, guid FROM wp_posts WHERE post_type=”attachment” +——+————+——————————————————————————————-+ | ID | post_type | guid | +——+————+——————————————————————————————-+ | 3507 | attachment | http://localhost:8000/wp/wp-content/uploads/2016/04/965299442994c85c_org.jpg | | 3485 | attachment | http://localhost:8000/wp/wp-content/uploads/2017/10/ab7c1762d9245ea3_org.jpg | | 3483 | attachment | http://localhost:8000/wp/wp-content/uploads/2017/11/a5e7f0092e77337d_org.png | | 3465 … Read more

wp_set_object_terms setting only first id from array

Turns out someone had the same problem and answered their own problem here. wp_set_object_terms not accepting variable array Here’s my working solution for my problem: $image_category = array_map(‘intval’, $_POST[‘image_category’]); wp_set_object_terms($product->get_id(), $image_category, ‘product_cat’); Hope this helps someone else. Thanks for reading.