Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter WP SITES

    (@wordpresssites)

    Without doing anything, they now display on the shop page but on the backend, they are blank. I wonder if it has anything to do with Jetpack?

    Hi,

    You can use the following code to forcibly regenerate thumbnails for the specific date range you mentioned. After regeneration, if an image is still blank on the server, delete the blank or corrupted images and regenerate again to see if that helps.

    wp media regenerate --yes $(wp post list --post_type=attachment --post_mime_type=image --post_status=inherit --after=2024-05-01 --before=2024-08-31 --format=ids)

    Regarding the Jetpack issue, you can open a support ticket on the plugin’s support page so they can investigate further and resolve it for you.

    Thread Starter WP SITES

    (@wordpresssites)

    Thank you. There are too many to delete. I have tried but no luck so i will contact Jetpack.

    Before contacting Jetpack, there’s actually a way to delete all the generated thumbnails and start fresh, which often fixes corruption issues. You can use this command:

    wp media regenerate --yes --only-missing $(wp post list --post_type=attachment --post_mime_type=image --post_status=inherit --after=2024-05-01 --before=2024-08-31 --format=ids)

    The –only-missing flag will skip images that already have thumbnails, but if you want to force delete and regenerate everything, you can manually remove the thumbnail files first.

    Actually, the cleaner approach is to use this two-step process. First, remove all the generated thumbnail files for that date range by running this command:

    find /path/to/wp-content/uploads/2024/05 /path/to/wp-content/uploads/2024/06 /path/to/wp-content/uploads/2024/07 /path/to/wp-content/uploads/2024/08 -type f -regextype posix-extended -regex '.*-[0-9]+x[0-9]+.(jpg|jpeg|png|gif)' -delete

    Just replace /path/to/wp-content/uploads/ with your actual uploads path. This finds and deletes only the resized versions (like image-300×300.jpg) but keeps your originals safe. Then run the regenerate command from before.

    If you’re not comfortable with the find command, the regenerate command alone should overwrite any corrupted thumbnails anyway. Give it a shot before reaching out to Jetpack support.

    Also make a complete backup of your website before running the regenerate or delete command so you can restore it to the previous state if anything goes wrong.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WP-CLI Regenerate Thumbnails Specific Date Range’ is closed to new replies.