WordPress Configuration Tricks You Should Know

WordPress Configuration Tricks You Should Know

WordPress Configuration Tricks You Should Know

In a WordPress theme, functions.php file is considered as the most important file. On the other hand, when we talk about the WordPress installation, wp.config.php is the most significant one during the entire configuration. This particular file can be utilized to help enhance performance, improve security on all possible WordPress powered blogs and websites and as well as configure database functionalities. In this particular article, we will introduce you to WordPress configuration tricks you should know.

WordPress installation does not really come with the wp-config.php file by default. It will only come with a sample file that is know as wp-config-sample.php. This particular file is what you will use as a sample in creating an actual wp-config.php file before you start setting up your own blog. This particular manual method is not actually opted by most users as the WordPress already lets you do that automatically even from their own installation setup. That particular setup is where you are adding or modifying key WordPress configurations. So, before anything else, we will have to walk you through first on that default setup lets you do.

If you upload WordPress through FTP and then access a particular website, you will see this in your screen:

configuration file

Basically, the default setup will tell you to utilize the wp-config-sample.php because it may not be able to work on all available web host providers. Though most of the web host providers is still proven to work with it. If you utilize one of the most popular hosts, there is no doubt that this will work. If you are done, the next step is as follows:

dabatase name

From there, you are asked to enter the essential information for your database. Those particular information lets the WordPress to connect with a certain database. Everything that you will enter in the particular setup will be added into your own  wp-config.php file as:

1

As default, the database host will be under the localhost as it works with most of the web host providers. However, there are web host providers that varies with the configuration. If so, you will have to modify this if you are utilizing the hosts that follows:

  • GoDaddy: h41mysql52.secureserver.net
  • Yahoo: mysql
  • Pair Networks: dbnnnx.pair.com
  • DreamHost: mysql.example.com

Other web hosting providers that you may also want are HostGators, BigRock, Bluehost and others as well.

Copy this line: “define(‘DB_HOST’, $_ENV{DATABASE_SERVER}); and paste this code. It serves to grab the database server. For this particular method, you will have to edit the wp-config.php file manually.

WordPress Configuration Tricks You Should Know

Here are the WordPress configuration tricks you should know that are divided by category:

Securing Your WP-Config File

As mentioned above, the most important file in WordPress installation is the wp-config.php file which means, it needs more security. This makes it the best WordPress configuration tricks you should know above anything else. The particular file, as mentioned, can be found in the root WordPress folder by default but you can be able to move it. It can also be moved just outside your public_html directory so that other users will not be able to access it. By default, the WordPress will look into the other directories if ever the files are not found in the root folder of WordPress. You may also make use of the .htaccess file for you to limit access to the particular file.

Make sure to add the following code:

3

Enable Multi-Site Network

In the WordPress 3.0 version, the WordPress core is merged with WPMU. For you to enable a multi-site network functionality, you will have to add a few codes into your wp-config.php file.

4

If you add this line of code, a new page will be added in your wp-admin named “Network” which is just located in Tools > Network.

From there, you just have to follow the directions on that particular page for you to continue the setup of the MU Network.

Custom User / UserMeta Tables

All user data of WordPress are in wp_usermeta and wp_users tables by default. By utilizing the function down below, you can be able to specify the table where you wish the user information to be stored.

5

WordPress Error Log

Error log for a website is actually very useful, especially for web developers. This is why it is one of the WordPress configuration tricks you should know. By using the wp-config.php file, you will be able to create a simple error log for WordPress-powered website easily. The first thing that you should do is create a file named “php_error.log“. Make the file server-writable and be sure to place it into the directory of your own choice. From that file, be sure to edit its third line with the code that follows:

6

The latest version of WordPress from 2.6 can let you transfer your wp-content directory. It will help with your website’s security. For you to move the wp-content directory, be sure to add the code that follows in your website’s wp-configphp file:

7

If you have noticed, we have defined the plugin directory as some plugins might not be able to work if those are not define specifically.

Increase PHP Memory Limit

Users would commonly see WordPress Memory Exhausted Error when they are activating some plugins. You can actually increase the PHP Memory Limit from the wp-config.php file. Yes, one of the good WordPress configuration tricks you should know. You just have to copy and following codes below into the file:

8

Unfortunately, there are some web host providers that would not be able to cater this feature. So, you will have to contact your web host providers customer support for them to assist you.

Auto Database Optimization

From the WordPress 2.9 version, there is actually a feature named Automatic Database Optimization. For you to enable this particular feature, do use the following line of code:

9

Once you are done activating the feature, you can be able to navigate the settings through this page: http://www.yoursite.com/wp-admin/maint/repair.php

FTP / SSH Constants

WordPress will allow you to upgrade the plugins by default. The WordPress core versions will allow you to do so through accessing it in the backend. Some of the web host providers  will require you to install or upgrade a new plugin through SSH or FTP connection. By making use of the following codes, you will be able to set the SSH or FTP constants and leave any worry behind.

10

WordPress Trash Feature

The WordPress 2.9 version has an added “Trash” feature that is added into the core. How does this feature works? Well, it is actually just the same  as the recycling bin. So, instead of deleting a certain post permanently, you will have to send it to the Trash. This feature is actually very helpful for those users who have accidentally clicked the Delete button. However, the fallback of this particular feature is having to empty the trash regularly. Though, the trash feature automatically empties itself by default every 30 days. You can actually modify it through the following line of code:

11

On the other hand, if you do not like this certain feature, you can just disable it with this function:

12

However, be reminded that keeping the value to 0 will make the WordPress automatically delete a file when you click Delete Permanently, without asking for confirmation. With this, any possible accidental click will lose you the file permanently.

Post Revisions

In the updated version of WordPress, there is another additional feature named Post Revisions. Another WordPress configuration tricks you should know. This particular feature auto-saves posts in case your web browser crashes or something along that line happens. This will allow user to restore their files back or get back to their previous versions if ever they do not like the current changes and so on. Though there are others who loves this feature, there are also some who do not like this certain feature. This certain feature has a lot of configurations to work it right.

The WordPress auto-saves post by default ever after 60 seconds. If you think that this is just too  much, then you can try modifying it to your own preference through this configuration:

13

Some posts will have 10, 20, or even 100 revisions depending on the blog owner’s preference. If this annoys you, you can also limit the number of revisions per post  if you like with this following line of code:

14

You can change the integer with the number you desire.

If ever the settings does not satisfies you, you can just disable post revision feature with this line of code:

15

Override File Permissions

Some of the web host providers have restrictive permissions for user files. But, you can change the file permissions by overriding it. Most does not actually need this, but some of the web developers would like to extend lift up this kind of restrictions. You will be able to override file permissions through adding the following code:

16

Blog/Site Address

By default, the WordPress Settings of your website have to have a specified WordPress address and as well as site address. Those particular information are added into your database. Every time that the web developer calls it from the template, it is being run through database query. In the WordPress 2.2 version, those particular settings are introduced to override the values of the database without having to change them:

define('WP_HOME', 'https://www.hostingdecisions.com');
define('WP_SITEURL', 'https://www.hostingdecisions.com');

If you add those line of codes in your wp-config.php file, you are actually reducing the number of queries in your database which helps increase your website’s performance. This is one of the best WordPress configuration tricks you should know.

Have any other tricks to share for this WordPress configuration tricks that you should know page? Do let us know and comment down below. And if you are having doubts with your current WordPress web host services, you may want to know how to choose the right one for you. Go and check out this article out: Choosing the Right WordPress Web Hosting!

Comments

comments

Written by:

Ryan Jacob

Ryan Jacob has 9 years of rich experience in Integrated Marketing Communications and Server Management. He has lead teams of professionals in his career and built online and offline reputation of organizations.

View All Posts

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.