Change default attachment display settings in WordPress
Updated On May 23, 2015 July 10, 2013 -Written ByTired of changing image or media attachment setting at every upload? By default, there is no settings feature in WordPress Dashboard to modify default “attachment display settings”. For example: if image aligment is set to “left” and image hotlinks to “post” – you need to manually change this at every image upload routine.
Modify default attachment display options in WordPress
1. You can easily change default settings for image or media attachments in WordPress. Just add the following code to functions.php file of your WordPress theme for this change.
https://gist.github.com/5963575
2. In above code: For image alignment (image_default_align), you can use left, right, center options. For image linking (image_default_link_type), you can use custom (for linking to custom url), post (links to dedicated url), file (links to direct image url), blank (no link). You can also change options for image size (image_default_size).
Another way of editing Options.php file
You can also make above change by editing options.php file of your WordPress website. Instead of above code, open options.php file and look for (image_default_link_type) in it. Modify setting for the same in options.php. But this method is not recommended, as you will lose this customization during WordPress upgrade to new version. Using above method of adding code to functions.php file is recommended.
Hi there,
Very nice article. I need to modify the attachment display settings for audio files. In the current version of wordpress whenever i add a mp3 file to my post, the default option is ‘Embed Media Player’, rather i want it to be changed the second option in the list that is ‘Link to Media File’. Please help i need this.
Thank you in advance