Skip to content

Instantly share code, notes, and snippets.

@WordPress-Handbuch
Created April 11, 2019 06:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WordPress-Handbuch/5df5afbdd3e797367eca90c441f3c712 to your computer and use it in GitHub Desktop.
Save WordPress-Handbuch/5df5afbdd3e797367eca90c441f3c712 to your computer and use it in GitHub Desktop.
Display new image sizes choices set through add_image_size() also in the backend in the right sidebar when editing an image
function wh_add_image_sizes_to_backend( $existingsizes ) {
$addsizes = array(
"wh-homepage-teaser" => 'WH Homepage Teaser',
"wh-landingpage-stage" => 'WH Landingpage Stage',
"wh-detailpage-feature" => 'WH Detailpage Feature'
);
$newsizes = array_merge( $existingsizes, $addsizes );
return $newsizes;
}
add_filter( 'image_size_names_choose', 'wh_add_image_sizes_to_backend' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment