Managing Your Media

Stephen Yagielowicz

WordPress is renowned for many things, including the flexibility of its multimedia display options and ability to allow site visitors to upload their own content files, but this is not always a good thing.

By default, WordPress uses “/wp-content/uploads/” as its upload path, but for security- conscious webmasters, or those with other needs, using the default media upload path may not be the best bet.

The admin update method is preferable to modifying the WordPress core files.

Fortunately, this is easy to change.

According to the WordPress Codex (, the default upload path is changeable by adding a line of code to the wp-config.php file. Using this method, a webmaster simply places this code: define(‘UPLOADS’, ‘wp-content/myimages’); immediately prior to this wpconfig line: require_once(ABSPATH.’wpsettings.php’); (changing ‘wpcontent/myimages’ to the desired directory path).

If you enable “uploads_use _yearmonth_folders” then these uploads would be saved in a “wp-content/myimages/2011/07” folder, where 2011 is the current year and 07 (July) is the current month.

Note that if the “myimages” directory did not exist, Word-Press would create it, as long as its parent folder (in this example, “wp-content”), is writeable.

While following the advice given by the Codex is usually wise, the above method requires users to modify one of the WordPress core files — and that is rarely a good idea.

A better alternative within the WordPress admin is under Settings > Media > Uploading Files.

Enter your desired media upload path, such as “/home/username/public_html/blog/images,” into the “Store uploads in this folder” field and optionally, the folder’s URL into the “Full URL path to files” — for example, Select “Organize my uploads into month- and year-based folder” if desired, then “Save Changes” and you are good to go.

For many users, the default settings may be fine, but if you want to change yours, the admin update method is preferable to modifying the WordPress core files.