How To Set Default Attachment Display Settings In WordPress

Status
Archive. Not re-tested yet.
Written
Note
Steps and screens may have changed since. Check them against your own WordPress before you rely on them.

Whenever you insert an image from the WordPress’ media uploader, it allows you to set the attachment display settings in the right side of the pop-up modal. You always have to customize the display settings and it wastes a lot of time.

Bavotasan.com has a great code to set default attachment display settings by using your theme’s functions.php file. Add following snippet to your theme’s functions.php file:

add_action( 'after_setup_theme', 'default_attachment_display_settings' );
/**
 * Set the Attachment Display Settings "Link To" default to "none"
 *
 * This function is attached to the 'after_setup_theme' action hook.
 */
function default_attachment_display_settings() {
	update_option( 'image_default_align', 'left' );
	update_option( 'image_default_link_type', 'none' );
	update_option( 'image_default_size', 'large' );
}

Here are the options for each:

image_default_align

  • left
  • right
  • center
  • none

image_default_link_type

  • file
  • post
  • custom
  • none

image_default_size

  • thumbnail
  • medium
  • large
  • full

More re-tested in WordPress

1 comment

  1. I know this is a little old but you can also access options directly and let them without having to mess with functions.php. Just go to wp-admin/options.php and search for image_default_align and you can adjust all 3 settings.

Leave a comment

Your email address won’t be published. Name, email and comment are required.