Related PostsGive your site a little beauty with use of some Google fonts with wordpress. WordPress Loop Beginner’s guide on how to display related posts in WordPress with or without plugin. Beginner’s Guide to The “Famous 5 Minute of Installation of WordPress” with Wamp! Make yourself visible on the web with the help of gravatar profile

Unfolding The Magical File of The WordPress : wp-config.php

There is a reason that i used the word magical cause it automatically generated throughout the “famous 5 minute installation of WordPress”. On the other hand it helps to debug the WordPress and to meet our requirement for the online functionality.

In the same way wp-config.php file holds the nerve for the functionality and flexibility of the WordPress . WordPress developer should customize this file as per the requirement of different WordPress projects considering that default setting of the WordPress that should not change because of the file that is coded with full of variables and constants, it can be edit easily to change the default setting of WordPress . You should make changes regarding to the WordPress coding standard and functionality. no matter how you customize it, but the key configuration of ABSPATH must remain unchanged as the file wp-config.php always end as per the below code.

require_once(ABSPATH . 'wp-settings.php');

WordPress developer has to deal with errors and warning, during the development of themes and plugins, but as we just discussed above the default setting of the WordPress don’t allow to show error related code and the reason of that suppresses is that you actually never want that code(error log) appears on your live site, and the reader of your website make fun of you.

i mean if you will turn ON your debug mode as

define('WP_DEBUG' , true);

then log will obviously gonna appear on your website and if you turn it OFF as

define('WP_DEBUG' , false);

You can’t figure out the errors cause the very first step to solve any particular error is to find that error first!

What should you do then? Confused?

Don’t worry dude, it’s WordPress the most powerful CMS and it has solution of every problem. You can edit your wp_config.php file by adding this two lines of code to override the default setting of the WordPress .

define( 'WP_DEBUG_DISPLAY', false );
define( 'WP_DEBUG_LOG', true );

And as per the constants signify it’s easy to understand as first constant WP_DEBUG_DISPLAY set to false, that will not show the error log in your live site, and the second one set to true that will display your error log in your content directory.

Security of the website is the biggest issue WordPress developer could ever come across. Though most hacker knows the root directory of WordPress theme it would be better to change the name of the wp-content folder. that could give hackers kind of pain in the butt. you can change it as follow:

define( 'WP_CONTENT_DIR', dirname(__FILE__)  . '/new-wp-cotent/' );

It’s not over, this magical file has bunch of customization within itself, for example we can put limit over how many time should post revision count.

Oh, feeling spaced out, let me get out of that fog. post revision means when you create post, it is saved in the database of the WordPress . every time you make the change in existing post, a copy of that post get stored in your database.

For instance you made couple of changes for 10 times, then your database will now have 10 copies of that one single post and it will make your website overweight like person with the weight of 250 pound. But the best thing about WordPress is that you don’t have to take gym-classes to overcome or lose this weight(load), because WordPress itself got a gym-classy function to control the weight of your database, and it will limit the number of revisions.

define('WP_POST_REVISIONS' , 5);

And if you want the fit body database for lifetime, i mean if you want to disable the post revisions completely, then you can add this code:

define('WP_POST_REVISIONS' , false);

You want some more?

Here you got. Have you ever been get frustrated because of automatic update of WordPress core, themes or plugin during you had hard time with your internet connection? it’s okay, if you ever been to that situation then add below code to our magical file:

define('WP_AUTO_UPDATE_CORE' , false);

Plus if you want to disable the plugin and theme editors, you should use this code:

define('DISALLOW_FILE_EDIT' , true);

Keeping this article to becoming so long we should break it here, but if you wants to get more tricks on customizing wp_config file go to the Generatewp and you will get solution to any of your problem with wp-config.php(our magical) file.

One Reply to “Unfolding The Magical File of The WordPress : wp-config.php”

Leave a Reply

Your email address will not be published. Required fields are marked *