mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-04-29 11:32:21 +08:00
https://developer.wordpress.org/news/2024/07/04/15-ways-to-curate-the-wordpress-editing-experience/#set-the-default-image-size
12 lines
341 B
Text
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 );
|