Change WordPress default folders

Last Revised: October 2, 2021

When you talk about WordPress it is a classic to talk about the “uvedoblepé content” [/wp-content/] referring to the default folder where templates, files, etc. are located. This is a simple way to detect if your installation has WordPress; but the system allows you to change these folders to other names that you want. To do this you can modify some elements in the configuration file [wp-config.php]:

Contents folder [/wp-content/]

define('WP_CONTENT_DIR', '/contenidos');
define('WP_CONTENT_URL', 'https://www.example.com/contenidos');

Plugins folder [/wp-content/plugins/]

define('WP_PLUGIN_DIR', '/contenidos/mejoras');
define('WP_PLUGIN_URL', 'https://www.example.com/contenidos/mejoras');

Templates folder (themes) [/wp-content/themes/]

$theme_root = WP_CONTENT_DIR.'/plantillas';
define('UPLOADS', 'contenidos/plantillas');

wp-config file.php

If you don’t want your file wp-config.php to be accessible via URL, one simple thing to do is simply move it to the top folder of your file system. This means that if for example your file is in the path [/webs/example.com/wordpress/wp-config.php] you can move it to [/webs/example.com/wp-config.php] and automatically the system will work.

Keep in mind that there may be plugins, templates or other tools that try to directly access the file and do not find it, so it is surely better to protect it from external access than not to change its directory.


Seguir con Seguridad para WordPress


About this document

This document is regulated by the EUPL v1.2 license, published in WP SysAdmin and created by Javier Casares. Please, if you use this content in your website, your presentation or any material you distribute, remember to mention this site or its author, and having to put the material you create under EUPL license.