How to Set Automatic Default Attachment Display Settings

If you want to set automatically image on left, right or center with small, medium or full size. But not know how to set automatically . So use given code on your WordPress theme.

How to Set Automatically image settings

  • Open functions.php file and paste given code there.
function wps_attachment_display_settings() {
update_option( 'image_default_align', 'left' );
update_option( 'image_default_link_type', 'none' );
update_option( 'image_default_size', 'large' );
}
add_action( 'after_setup_theme', 'wps_attachment_display_settings' );
  • Then click to SAVE button for save or take changes.

Changeable

image_default_align to left, right or center
image_default_size to small, meduim, large or full

Hope this code will work. Thanks for visiting.