miguel.nz

Default attachment display settings on WordPress

June 30, 2014   |   1 minute read.

The following snippet helps you to control default attachment display setting when you load images on wordpress. The most common case for me is removing the image link so then when I add any picture I don’t have to remove the link or modify anything.

add_action( 'after_setup_theme', 'default_attachment_display_settings' );
function default_attachment_display_settings() {
	update_option( 'image_default_align', 'left' );
	update_option( 'image_default_link_type', 'none' );
	update_option( 'image_default_size', 'large' );
}

See more about After Setup theme. Thanks to bavotasan.