Is there a way to set default image aspect ratio?

[ad_1]

Hi, I noticed there is no way to set default settings for the image block, I want the aspect ratio to be always wide (to avoid image distortion).

I saw one can modify the functions.php file and try that with no success.

function set_default_image_aspect_ratio($settings) {
$settings[‘image’][‘default’] = ‘wide’; // Change ‘wide’ to your desired aspect ratio
return $settings;
}
add_filter(‘block_editor_settings_all’, ‘set_default_image_aspect_ratio’);

Actually, I didn’t find much examples on how to use that block_editor_settings_all filter.

Is my función correct? Is there an easier way? Thanks!

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer