[wp-trac] [WordPress Trac] #28512: Make the post thumbnail size filterable for the Featured Image meta box
WordPress Trac
noreply at wordpress.org
Thu Jun 12 20:57:17 UTC 2014
#28512: Make the post thumbnail size filterable for the Featured Image meta box
-----------------------------+------------------------------
Reporter: DrewAPicture | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Post Thumbnails | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
-----------------------------+------------------------------
Comment (by SergeyBiryukov):
> Currently, the only way to change the size is by duplicating the code in
`_wp_post_thumbnail_html` on the `admin_post_thumbnail_html` hook.
You can actually use `image_downsize` filter instead:
{{{
function change_featured_image_size_in_admin_28512( $downsize, $id, $size
) {
if ( ! is_admin() || ! get_current_screen() || 'edit' !==
get_current_screen()->parent_base ) {
return $downsize;
}
remove_filter( 'image_downsize', __FUNCTION__, 10, 3 );
$image = image_downsize( $id, 'medium' );
add_filter( 'image_downsize', __FUNCTION__, 10, 3 );
return $image;
}
add_filter( 'image_downsize', 'change_featured_image_size_in_admin_28512',
10, 3 );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28512#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list