Code-Snippets-Functions/Execute a function on a child site/WordPress/set-the-default-image-size-block-settings.txt

12 lines
341 B
Text

function example_set_default_image_size( $settings, $context ) {
if (
! empty( $context->post ) &&
'post' === $context->post->post_type
) {
// Set the default image size to full.
$settings['imageDefaultSize'] = 'full';
}
return $settings;
}
add_filter( 'block_editor_settings_all', 'example_set_default_image_size', 10, 2 );