You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I changed the "medium" image size in the WordPress media settings from 360x360px to 400x400px and ran the following command:
wp media regenerate --missing-only
The images were regenerated, but some were skipped as "No thumbnail regeneration needed". I later discovered that the meta data in the image attachments for those that were skipped still referenced the 360px version of the "medium" sized image. I identified all affected image attachments and then ran:
wp media regenerate [attachment-ids]
This successfully updated the attachment meta and removed the reference to the 360px version of the image. I believe this occurred on images that were <= 400px.
It appears that if the command sees that the original image is the same size or less than the target, it is skipped but in doing so the meta is not updated to reference the original image.
Describe how other contributors can replicate this bug
Set medium size images to 360 x 360 in WordPress settings
Upload an image of size 400 x 400
Change medium size images to 400 x 400 in WordPress settings
Run wp media regenerate --missing-only
Image is skipped, meta for medium refers to the 360x360 version of the image
Example meta (note 360px image still referenced as "medium" size):
Describe what you would expect as the correct outcome
Image meta should be updated.
Let us know what environment you are running this on
OS: Linux 5.14.0-427.40.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Oct 16 14:57:47 UTC 2024 x86_64
Shell: /sbin/nologin
PHP binary: /usr/bin/php
PHP version: 8.2.25
php.ini used: /etc/php.ini
MySQL binary: /bin/mysql
MySQL version: mysql Ver 15.1 Distrib 10.5.22-MariaDB, for Linux (x86_64) using EditLine wrapper
SQL modes:
WP-CLI root dir: phar://wp-cli.phar/vendor/wp-cli/wp-cli
WP-CLI vendor dir: phar://wp-cli.phar/vendor
WP_CLI phar path: /var/www/vhosts/X/releases/194
WP-CLI packages dir:
WP-CLI cache dir: /usr/share/httpd/.wp-cli/cache
WP-CLI global config:
WP-CLI project config: /var/www/vhosts/X/releases/194/wp-cli.yml
WP-CLI version: 2.11.0```
The text was updated successfully, but these errors were encountered:
jamieburchell
changed the title
Images skipped due to "no regeneration necessary" have outdated meta data
Images skipped due to "no regeneration needed" have outdated meta data
Nov 5, 2024
Bug Report
Describe the current, buggy behavior
I changed the "medium" image size in the WordPress media settings from 360x360px to 400x400px and ran the following command:
wp media regenerate --missing-only
The images were regenerated, but some were skipped as "No thumbnail regeneration needed". I later discovered that the meta data in the image attachments for those that were skipped still referenced the 360px version of the "medium" sized image. I identified all affected image attachments and then ran:
wp media regenerate [attachment-ids]
This successfully updated the attachment meta and removed the reference to the 360px version of the image. I believe this occurred on images that were <= 400px.
It appears that if the command sees that the original image is the same size or less than the target, it is skipped but in doing so the meta is not updated to reference the original image.
Describe how other contributors can replicate this bug
wp media regenerate --missing-only
Example meta (note 360px image still referenced as "medium" size):
Additionally, the old 360px medium size image file is not deleted from the filesystem.
Example meta after running
wp media regenerate [attachment-id]
on affected image (note 360px version removed from meta and filesystem):Describe what you would expect as the correct outcome
Image meta should be updated.
Let us know what environment you are running this on
The text was updated successfully, but these errors were encountered: