What is WordPress File Structure and How to Configure wp-config File

Share this:

Hi, how are you? Hope you’re doing well.

In this article we’ll cover what is wordpress file and folder structure and how you can configure wp-config file.

Exploring the Code

The WordPress source code file options many alternative PHP, JavaScript, and CSS code files. Each file serves a particular purpose in WordPress.

The sweetness of open source software system is that each one code is publically available, which suggests you’ll simply explore the code for better understanding of how WordPress functions.
After extracting the WordPress download you’ll notice the set file structure for WordPress, as shown
in Figure 1.

Click to expand the images.

Default WordPress Folder and File Structure
Figure 1: Default WordPress Folder and File Structure

WordPress comes with 3 directories by default: wp-admin, wp-content, and wp-includes. The wp-admin and wp-includes directories embrace core WordPress files that you just should never edit.

The root directory of WordPress additionally contains vital core files, a number of that you may edit presently during this article. The wp-content directory holds all of your custom files together with themes, plugins, media, and eventually way more. This directory is that the code that controls content manipulation and presentation in WordPress.

Modifying any of the core WordPress files may result in an unstable website. This additionally makes it terribly difficult to upgrade WordPress, as a result of all changes created are overwritten once the updated version of WordPress is put in.

Core files visit all files within the wp-admin and wp-includes directories. The majority of the files within the root WordPress directory are thought of to be Core. Within the next section,
we’ll discuss wp-config Core files that may be changed. In general, though follow this rule: Don’t hack core!

Configuring Key Files

WordPress options specific files that may be altered for various functions. These files will alter however WordPress functions. Invariably take a look at changes during a development setting before publication to a production server.

In this section, we’ll discuss database connections, storing FTP information, enabling debugging tools, and more using wp-config.php. We’ll additionally discuss the ability of the .htaccess file, together with increasing PHP memory limits and max upload sizes, making redirects, and access restrictions.

wp-config.php File

The most vital file in any WordPress installation is that the wp-config.php file. This files stores all database connection settings, together with the database name, username, and password to access your database.

This file additionally stores further information, security, and alternative advanced settings. The wp-config.php file is originally named wp-config-sample.php. Renaming the file to wp-config.php is one of the primary steps to installing WordPress.

The wp-config file is usually kept within the root directory of WordPress. Instead, you’ll move the wp-config file outside of WordPress one directory. Therefore if your WordPress directory is found here:
you can safely move the file here:

WordPress seeks for the wp-config move into the root directory initial, and if it can’t notice that file it’s up one directory. This happens automatically therefore no settings have to be compelled to be modified for this to figure.

Options in WordPress are kept as constants and these will be seen within the wp-config.php file. The constraints all have constant format:
define(’OPTION_NAME’, ‘value’);
OPTION_NAME is that the name of the option constant being set. ‘value’ is the option value and may be updated to no matter what setting you’d prefer to save for that option.

If your WordPress installation has issues connecting to your database this is often the primary place to start troubleshooting. Verify that the DB_NAME, DB_USER, and DB_PASSWORD choices are properly set for your database server. Additionally verify that the DB_HOST name is set to the correct host for your server.

Typically this is often set to localhost, however some hosting corporations need a custom value. Contact your hosting technical support or consult their on-line documentation for the right host value to set here.

You can modify the database character set(charset) by ever-changing the DB_CHARSET choice value. By default this is often set to utf8 (Unicode UTF-8), that supports any language, and is nearly invariabily the simplest option.

The DB_COLLATE choice has allowed designation of the database collation, that is, sort order of the character set. (A character set may be a assortment of symbols that represents words during a language. The collation determines the order to use once sorting the character set, sometimes alphabetical order).

This feature by default is blank and may usually keep that approach. If you’d prefer to modify the database collation simply add the suitable worth for your language. You must modify this feature before putting in WordPress. Fixing this value when installation may cause issues in WordPress.

WordPress security is reinforced by setting secret keys in your wp-config.php file. A secret key is a hashing salt, that makes your website more durable to hack by adding random parts (the salt) to the password you set. These keys aren’t needed for WordPress to operate, however they add an additional layer of security on your website.

To have secret keys auto-generated for you, visit the link to WordPress.org for secret key generation
in your wp-config.php file (https://api.wordpress.org/secret-key/1.1/), shown in Figure 2.
Alternatively you’ll simply type bunch of random characters in place of ‘‘put your unique phrase here.’’ The goal is to use secret keys that are 100% random and distinctive.

Arbitrarily Generated Secret Keys
Figure 2: Arbitrarily Generated Secret Keys

You can add or modify these keys at any time; the sole issue that may happen is all current WordPress cookies are invalid and your users are needed to log in once more.

Another security feature enclosed in wp-config.php is setting your WordPress database table prefix. By default this feature worth is ready to words per minute. You’ll modify this value by setting the $table_prefix variable value to any prefix you’d like.

If a hacker is ready to take advantage of your website using SQL Injection, this can create it more tougher for him to guess your table names and quite presumably keep him from doing SQL Injection the least bit. Setting the table prefix to a singular worth additionally makes it doable to run multiple WordPress installations during a single database.

If you want to alter the table prefix when you have got put in WordPress, you’ll use the WP Security Scan plugin (http://wordpress.org/extend/plugins/wp-security-scan/) to try and do therefore. Ensure you make an honest backup before doing this, though.

The wp-config file additionally contains the choice for localizing your installation of WordPress. WordPress has the inherent capability to be utilized in many alternative languages. Setting the WPLANG choice worth sets the default language for WordPress to use. A corresponding MO file for the chosen language must be put in to wp-content/languages for this feature to figure.

MO (machine object) files are compressed PO (portable object) files, that contain translations for WordPress messages and text strings during a specific language. The MO and PO files are elements of the gnu ‘‘gettext’’ system that underlies the WordPress multi-language capabilities. For a full list of obtainable MO language files visit the subsequent resources:

➤ WordPress in Your Language Codex page: http://codex.wordpress.org/WordPress_in_Your_Language
➤ WordPress Language File Repository: http://svn.automattic.com/wordpress-i18n/

In conclusion, editing wordpress core key file can seem like a daunting task. However, when you break it down into steps and spend a little time planning up front the process easily falls into place.

Have you used WordPress or any other CMS before? Which do you like best and Why? Let me know in the comments!

Did you like this guide of WordPress file structure and how to configure wp-config file? Share it with your friends on Facebook, Twitter, and Google Plus!

Don’t forget to Subscribe to our Newsletter for more insightful post updates, tips and guides!

Stay awesome!

Authored By Aakanksha Singh

Hi, I’m Aakanksha, a computer science engineer and the founder of TheTechPower. I help people make there online presence process easier by empowering them with clean, beautiful and easy to use wordpress themes.

Share this:

2 Comment

  1. The above comment was a spam. You should be more careful with such. By the way nice article. But I’d suggest you to have sub headings also.. So that a reader can find a flow.

    If you find my comment helpful. Follow me on twitter, @venusvavadiya

    1. Aakanksha says: Reply

      Thanks for your comment. Will try and implement nice subheadings for my next post and thanks for the heads up. If you liked the article please subscribe.

Leave a Reply