Make WordPress Core

Opened 8 years ago

Last modified 3 years ago

#37311 reopened defect (bug)

Site icon thumbnails are lost if wp_generate_attachment_metadata called again later

Reported by: smerriman's profile smerriman Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.5
Component: Media Keywords: needs-patch
Focuses: Cc:


If image sizes are regenerated with the Regenerate Thumbnails plugin, the custom Site Icon sizes (and possibly other images in the customiser?) are lost.

The question is whether this is something that needs changing in the plugin, or whether the logic for how these sizes work should change in core. (Virtually all core documentation tells people to use this plugin when changing image sizes, so it should be fixed in one of the other).

I'm of the opinion it should be changed in core, where custom sizes like the ones created by Site Icons should be somehow marked as special sizes, with wp_generate_attachment_metadata checking for any existing custom sizes and including them in the output.

Change History (10)

#1 @Viper007Bond
8 years ago

OP also opened an issue on my side of things here:

Probably on me to fix it, but it is an interesting situation.

#2 @ocean90
8 years ago

  • Version changed from trunk to 4.5

#3 @Viper007Bond
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I'll be handling this on my end by not regenerating any sizes being used for site icons. Going to close this here as wontfix as it's not really core's job to worry about this, rather the plugin that is calling wp_generate_attachment_metadata() should.

#4 @smerriman
7 years ago

Are you going to hard code in a special case for site icons, or will the logic be able to be applied to other sizes? For example, a theme I've built uses the same type of code to generate a special logo size; that also gets lost on regenerate. That's why I was thinking there needed to be some sort of flag stored with the image on core's side that the call to the function could ignore.

#5 follow-up: @joemcgill
7 years ago

  • Component changed from Customize to Media
  • Keywords reporter-feedback added
  • Resolution wontfix deleted
  • Status changed from closed to reopened

I'm not opposed to including a fix in Core for this, if one makes sense. Can we also confirm whether this behavior is reproducible when doing thumbnail regeneration via WP-CLI?

#6 in reply to: ↑ 5 @kirasong
7 years ago

Replying to joemcgill:

I'm not opposed to including a fix in Core for this, if one makes sense.


#7 @SergeyBiryukov
6 years ago

  • Milestone set to Awaiting Review

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

3 years ago

#9 @antpb
3 years ago

  • Keywords needs-patch added; reporter-feedback removed

This was mentioned in a recent Media component bug scrub. This ticket seems to still have a valid need for a fix Core side, but has not seen attention for a bit of time. I think we could maybe learn from the fix that was added plugin side to inform what next steps we need for this ticket.

Mentioned by @joedolson in the scrub "One risk to keep in mind is that creating an exception could run into problems if changes happen to how site icons should be presented in contexts not handled by core. It creates a surprise behavior in the function if it doesn't work the same way on all images."

This ticket was mentioned in Slack in #core-media by antpb. View the logs.

3 years ago

Note: See TracTickets for help on using tickets.