Ollie Theme Academy

Creating Performant Themes

Implementing performant images – B

Configure image sizes to match your theme’s content size and wide size exactly, ensuring optimal performance without bandwidth waste. The cleanest approach reuses WordPress’s existing medium and large sizes rather than creating custom ones.

Use pre_option filters to override WordPress’s default image size settings programmatically rather than requiring manual admin configuration. This ensures consistent sizing across all site installations.

Hook into both width and height options for medium and large sizes, typically using the same value for both to maintain WordPress’s square-based sizing approach. Extract values from your theme.json content and wide sizes.

After implementing size changes, regenerate existing thumbnails and re-add images to posts to apply new sizing. WordPress hardcodes size references in image blocks, requiring manual updates for existing content.

Back to: Ollie Theme Academy > Creating Performant Themes