Created
October 24, 2019 00:54
-
-
Save kevindaus/eb2f14dca95631f72634215e9ae35b33 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
PRODUCT_ID=$1 | |
if [ -z "${PRODUCT_ID}" ]; then | |
echo "Requires a product ID" | |
echo | |
echo "run \"./script.sh <id>\"" | |
fi | |
IMAGE_GALLERY=$(wp post meta get "${PRODUCT_ID}" _product_image_gallery) | |
THUMBNAIL_ID=$(wp post meta get "${PRODUCT_ID}" _thumbnail_id) | |
RAW_IDS="${IMAGE_GALLERY},${THUMBNAIL_ID}" | |
IDS=`echo "${RAW_IDS}" | tr ',' ' '` | |
wp media regenerate "${IDS}" | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage
./script.sh <product_id>