Wordpress: Proper Folder Structure

Wordpress: Proper Folder Structure

Ultimate folder structure

Folder structure for save-up.at is simple and very nice! So only thing I really like is - one folder up for web…

Move wp-content */

define(‘WP_CONTENT_FOLDERNAME’, ‘content’);

/style (themes) /core (active main theme) /extend (active child theme)

/modules /core (plugins) /requisite (mu-plugins)


My Media Folder Structure

Rename “uploads” to “media” Use plurals for folder names.

/media (maybe assests?; uploads) -/t (from thumbnails;) The complete structure same as on main part, done by plugin Fr Thumbnails Folder w/PHP snippet

-/i (from images; imgs) Automatic folder structure by content using Custom Upload Dir User’s logical grouping and structure is achieved using HappyFiles or similar virtuals folders plugin.

-/g/ (from gfx; graphics) /g /g/branding (company logos, etc) / using full folder names for better SEO /g/hero (e.g. header images) / using full folder names for better SEO

/g/udr (undraw vector collection) / using three-letter abbreviations as I don’t want client to know what I’m using /g/odo (opendoodles vector collection) /g/usp (unsplash collection)

“Soft read-only” content as user shouldn’t modify these, just use them. Import just once using Bulk Media Register plugin

Force all new uploads to one subfolder using Custom Upload Dir plugin

Set up that every new upload goes to . My graphics Podešeno da je upload uvek u /i, a tamo ide po želji Može da se menja…

Generate wp-config.php File

define( ‘UPLOADS’, ‘wp-content/media’ );

Steps to implement:

  • Set my custom folder structure with changes in wp-config and one small mu-plugin for themes (which I soon won’t need)
  • Fr Thumbnails Folder so I have separate resized images
  • Custom Upload Dir so I force where new media will be stored
  • HappyFiles to group media files for clients

  • rename wp-content (safe to do / alternative to move level below)

    plugins: dodaci uploads: otprema, otpremnina Not sure if automatic updates of Wordpress will work?

    // define (‘WP_CONTENT_FOLDERNAME’, ‘assets’); // define( ‘WP_PLUGIN_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/extensions’ );

Rename-move wp-content

Translations: wp-content - assets, sastav, sadrzina, sadrzaj, smisao, german: ressourcen

Move wp-content as per Codex. Not sure if it will improve security.

Set constants WP_CONTENT_DIR and WP_CONTENT_URL and replace /wp-content/ with /assets/ in all the tables.

Sources & Articles

Move the wp-config.php file one directory up, outside of the web root directory?

WordPress will look inside the web root directory for the wp-config.php file as well as within the directory above it. This will help in minimizing the file being exposed to the Internet.

Great reasons for doing that. 10 wp-config Tweaks To Improve Your WordPress Site

Set perfect file permissions
  • perfect file permissions (see: Codex)

    • wp-admin/ (admin area), wp-includes/ (application logic) - writable only by ftp
    • wp-content/ (user-supplied content) - writable by user account and web server process
      • wp-content/themes/ - as I dont want to use the built-in theme editor, files writable only by your user account
      • wp-content/plugins/ - all files should be writable only by your user account. That’s why you set FTP account.
      • wp-content/* - may be present with and should be documented by whichever plugin or theme requires them


Move out the media upload folder

WordPress Optimization Guide - Things To Do After Installing Wordpress

There is an plugin to help out: Custom Upload Dir

security - Can I rename the wp-admin folder? - WordPress Development Stack Exchange

Change Locations of WordPress Folders

It’s possible for you to customize your WordPress file and folder structure by giving them different names or locations. You can change wp-content, plugins, and uploads folders.

After making changes, you’re required to update wp-config.php file so that it can define the new locations. You can do so by adding this code to the wp-config.php file:

define( ‘WP_CONTENT_DIR’, dirname(FILE) . ‘/newfolder/wp-content’ ); define( ‘WP_CONTENT_URL’, ‘https://your-site.com/newfolder/wp-content’ );

date 21. Dec 2016 | modified 25. Jan 2023
filename: Wordpress » Security » Rename Folders and Structure