6. Exploring WordPress & Configuring the wp-config.php file

Share this post on:

WordPress comes bundled with various files but the most important file is the wp-config top HP file. At the heart of every WordPress site is the configuration file. Let’s open the wp-config DOP HP file. It can be found in the root directory of your WordPress installation.

This file basically contains all your core settings such as the database log and details security hashes salts etc. in the resource section I provide a link to the WP config Codex documentation page. This page contains all the information that you’ll need to know to make changes to the config file. Unlike other core files, you’re allowed to edit this file without much consequence when word presses are updated. There are a lot of settings here but we won’t be going over most of them. You don’t need to worry about modifying this file much as the default settings are already optimized for your site.

WordPress takes care of this automatically for you. However, there is one setting we should modify. Go back to the config file and search for something called WP underscore debug.

By default, this value is set to false. Let’s change this to true what this will do is display any errors you receive in your code. It will provide more information to help you with debugging. I highly recommend you always do this during the development phase of any plugin or theme. When you’re ready for production be sure to change this back to false if this value doesn’t exist. Then you can just add in by default. It’ll always be false. So during installation, this file was automatically created for you if you were to open the zip file. You’ll notice there never was a WP config file. Instead, there is a file named wp config sample copy.

Pete let’s open this file. It can be found in our installation of WordPress. This file is just a  ummy file that we can rename to wp-config dot page v file and use it as the main config file.

It’s provided to us just in case WordPress is unable to generate this file for us during its user friendly installation you simply just have to change the values of these constants. If you’re unsure when each value means then refer to the documentation for more information. We don’t have to do this since the default installation worked for us. One thing I do want to note is the authentication section. You can find it if you scroll down just a bit. If you have to manually create this file then this section is super important. These keys are used to hash passwords and sensitive data. You’re free to come up with your own keys but if you’re not confident with what you came up with then WordPress has you covered. Go back to the documentation config page on the sidebar you’ll find a section called Security keys for me.

It’s number one point for you’ll find a link to an online generator that will generate random hard to crack keys. Let’s check it out on this page you’ll see that we get a set of keys that we can use in our file. You can refresh the page and you will always get a set of unique random keys. You can simply copy and paste this into the WP config page v file like so. Keep in mind that these are values that once you set you shouldn’t change afterward. Otherwise, you can cause problems with currently active accounts just in case you can’t find this link on the Codex page then you can check out this block comment right above inside this block comment you’ll see. WordPress provides a link to the online generator as well that ramps up the topic on configuring the WP config file.

Feel free to explore this documentation for more information on this file for our purposes. Just setting up the WP Debug constant to true is more than enough to get started. Let’s explore some of the other files and directories inside the root directory. You’ll find a couple of files here the files found inside the root directory determine what files should be loaded on every page request. Next, we have these three folders called WP dash admin WP dash content and WP dash includes. Let’s start with a WP dash that includes a folder. This folder contains classes and functions that help WordPress process requests. It’s important to understand that this is different from what you might find inside the root directory. The root directory files help loads and set up WordPress the files inside the WP dash includes folder provides functions and classes that WordPress uses to process data. A lot of the files inside this folder can’t do anything by themselves. For example, if I were to open the WP comments post stop HP file you’ll find a lot of logic being implemented here. This file will process commands for a blog post as you can see it doesn’t bother defining functions. Instead it just loads files and prepares variables inside the WP. The dash includes a folder. Open the admin bar dot P V file inside this file you’ll find a lot of functions defined here. However, you won’t find any logic being executed. This file doesn’t do anything by itself. That goes for a lot of files inside this folder. Moving on the WP dash admin folder is another default folder in WordPress. This folder handles its own requests unlike the other parts of WordPress WordPress uses the indexed page file to handle a majority of requests. However, if you visit the admin side of WordPress then the indexed P2P file doesn’t handle anything. Instead, WP dash admin is a directory that likes to be independent of the rest of the world press corps. All files here are just for the admin. There’s nothing much to it.

Honestly, the last folder is the WP dash content folder. This folder will contain all plugins themes and uploads. This is where we will be working for the majority of this course because of that. I won’t be talking too much about this folder in this lecture. What I will say is that WordPress will automatically add some plugins and themes which can be a great way to understand how to build your own themes and plugins. You are allowed to freely modify a lot of these files without much consequence. Before I end this lecture let’s configure the server in the Zam control panel navigate to Apache config P HP dot.

I am not. This file contains settings for our p HP environment. There are 3 settings I want to change the first setting is the max execution time. Search for it and set it to 500 this will allow our scripts to run for five hundred seconds. Realistically this should never be the case but if you ever decide to do something that is resource-intensive then you can avoid timeout errors by setting this value to a high number. The next value to set is the post-Max Size. Search for it and set it to 50 m. This will allow us to submit large requests up to 5 megabytes. There will be times where we will be submitting a lot of data. So setting this to a high number is beneficial to us. The last value to set is the upload Max file size 250 M which will allow us to upload files up to 50 megabytes. That’s it for now.

By making these changes to our environment we can now begin with developing plugins and themes for WordPress. You will need to restart the server for these changes to take effect. Do that before you move on to the next lecture.

 

Share this post on:

Leave a Reply