How resize default thumbnail size without admin-panel. WordP... open

How resize default thumbnail size without admin-panel. WordPress function example

You can default image size in admin-panel af yours WordPress site. For this go to Settings -> Media and set a new image size.

But what if it needs to be done in the code of your theme or plugin? The functions below will allow you to solve this issue.

First, you need to disable the default thumbnail sizes:

add_action( 'after_setup_theme', 'remove_plugin_image_sizes' );
function remove_plugin_image_sizes(){
	remove_image_size('image_size_name');
}

And after that, register this same thumbnail but with new dimensions:

add_action( 'after_setup_theme', 'remove_then_add_image_sizes' );
function remove_then_add_image_sizes(){
	add_image_size( 'image-size-name', 200, 200, true );
}
0

More

Leave a Reply

Your email address will not be published. Required fields are marked *

How many?: 22 + 22

lil-code© | 2022 - 2024
Go Top
Authorization
*
*
Registration
*
*
*
*
Password generation