18 Time-Saving WordPress Configuration Tips and Tricks (2022)

10 Jan, 2024
WordPress
18 Time-Saving WordPress Configuration Tips and Tricks

The WP-config file is a crucial component of WordPress’ internal workings, and it should not be underestimated. Most new WordPress users are unaware of a handful of quite important setup options. The WordPress setup tips and tricks in this post will help you troubleshoot, improve, and secure your WordPress-powered website.

WordPress Configuration Tricks: How Do I Use These Tips?

A wp-config.php file is a powerful configuration file that comes with WordPress. Usually, this will be located inside the root directory of your WordPress installation. This root directory of every WordPress site contains essential configuration options.

To avoid editing the wp-config.php file during the installation process, the leading WordPress hosting providers like Rovity offer 1-click WordPress installation. As a result, many users are unfamiliar with the file’s capabilities.

This wp-config file is a handy tool for maintaining, securing, and troubleshooting your WordPress site.

An error in the wp-config.php file can render your website inaccessible. Therefore take care when editing this file. When editing this file, you should only do so if necessary. You should always back up your entire site before making any changes.

If your website is hosted on Rovity’s cloud networks, we have enabled 24/7/30 back up, so you can rely on that. We can even restore one single file from your whole site.

Let’s see what WordPress configuration tips you may put to good use on your site.

Where Can You Find wp-config.php?

As a newbie to WordPress, you may wonder, “where is my wp-config.php?”

In the root directory of WordPress, you’ll find this core file, mostly, unless you or your hosting provider specified it.

Suppose your WordPress website is hosted on Rovity. In that case, you can log in to the DirectAdmin control panel and then use the built-in File Manager to locate the wp-config.php file. This is the easiest way to manage your files.

Or we can connect using FTP if you prefer that way or don’t have access to a control panel. Using an FTP client like FileZilla would be best to connect to your live server. You can find wp-config.php in the public_html directory after logging in.

With this foundation in hand, I’ll go into more depth on using this file to enhance your WordPress experience.

1 – Bypass FTP Connection

You can bypass the FTP connection information if you cannot update the WordPress core and plugins to a newer version because of a lousy FTP connection.

All you have to do is add the code below to the wp-config.php file to accomplish this:

define( 'FS_METHOD', 'direct');

2 – Activate WordPress Debugging Mode

WordPress has a handy function in debug mode that allows you to inspect or hide errors. You will need to add this rule to your WordPress configuration file to activate this feature.

define( 'WP_DEBUG', true );

Debugging can be enabled while errors are hidden and saved in a log file instead. You should add the following lines to your configuration settings to accomplish this.

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

Debugging information will be saved in a debug.log file created in your website’s wp-content folder.

3 – Change Site and WordPress URL

From the Settings > General tab, you can usually set your WordPress and Site URLs. You may not be able to do so if you don’t have access to your WordPress site, have redirect issues, or recently transferred your site.

You can add the following lines to wp-config.php to update your site and WordPress URLs:

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

Keep in mind to change example.com with your own website’s domain name.

4 – Increase or Decrease PHP Memory

If you’re not using Rovity’s WordPress hosting platform, you may find this function challenging to use.

PHP memory exhaustion is a common cause of WordPress issues. The wp-config.php file allows you to change the PHP memory limit. You can copy and paste the code below:

define('WP_MEMORY_LIMIT', '128M');

Users of Rovity do not need to change the wp-config file. They can use the DirectAdmin control panel to adjust the value.

5 – Modify Trash Box Timing

Trash is a function in WordPress that acts as a recycle bin. Even if a user deletes a post, your website retains it as trash for the next 30 days. They are automatically deleted from WordPress after that period.

Reducing how long you retain trash can help you solve this behavior.

define( 'EMPTY_TRASH_DAYS', 15 );

Setting the value to 0 instead of 15 will disable the Trash functionality. If you use the number zero, your posts will be permanently removed. When you click on Delete Permanently, WordPress will not ask for confirmation. You could make a loss if you mess up.

6 – Disable Automatic Updates

WordPress 3.7 includes the introduction of automated updating for minor core releases and translation files. You can disable these functionalities by adding the following line to wp-config.php:

define( 'AUTOMATIC_UPDATER_DISABLED', true );

You can add the following lines of code to the WordPress config file to prevent automatic updates for the WordPress core (minor and major upgrades).

To disable all core updates:

define( 'WP_AUTO_UPDATE_CORE', false );

To enable all minor and major core updates:

define( 'WP_AUTO_UPDATE_CORE', true );

7 – Set Autosave Intervals

WordPress offers a post revisions feature that allows you to revert to a prior version or an autosave of your posts and pages.

You can use the configuration file to disable or adjust post-revision settings. Listed below are several post-revision options for your consideration.

You can add the following line to the configuration file to determine how frequently WordPress stores an autosave as a revision:

define('AUTOSAVE_INTERVAL', 120);

Depending on how long it took to write, you may have had hundreds of post revisions on some posts on your site. This feature may annoy you, but it’s possible to limit the number of revisions that can be made for each post.

define('WP_POST_REVISIONS', 10);

You can use the following code to disable post revisions if, for some reason, you don’t want to utilize them. I don’t recommend it at all.

define( 'WP_POST_REVISIONS', false );

8 – Set Database Prefix

In a typical default WordPress installation, all WordPress database tables are prefixed with the wp_ prefix. According to some WordPress security experts, changing the table prefix can improve the security of your WordPress database.

The following line in your WordPress setup needs to be modified to accomplish this.

$table_prefix = 'wp_';

The table prefix in your WordPress database will also need to be changed if you are doing this for an existing website.

9 – Enable WordPress Multisite Network

A built-in multisite capability is included with every WordPress installation, allowing you to set up several WordPress sites with a single setup.

You can add the following line to your WordPress configuration file to enable multisite functionality:

define('WP_ALLOW_MULTISITE', true);

When you apply this code to your WordPress Admin, a new page called Network will be created in your WP Admin dashboard.

10 – Turn on WordPress Caching

To activate the WP-Cache, add the following code to the wp-config.php file.

define('WP_CACHE', true);

11 – Configure Database Settings

Database connection settings can be edited in WordPress’ config file and matched with your hosting’s database values (i.e., name, user id & password).

define('DB_NAME', 'database-name');
define('DB_USER', 'database-username');
define('DB_PASSWORD', 'database-password');
define('DB_HOST', 'localhost');

12 – Non-existing Subfolders and Subdomains Redirection

If a visitor tries to access a non-existent subdomain or subfolder on your website, redirect them to a specific page or URL. Paste the following code into the wp-config.php file.

define( 'NOBLOGREDIRECT', 'https://example.com' );

Replace “https://example.com” with the URL of your site.

13 – Set a Cookie Domain

WordPress gives you the option of customizing your site’s cookie domain (for uncommon domain setups). The code is here.

define( 'COOKIE_DOMAIN', 'example.com' );

14 – Override File Permissions

If your hosting provider restricts file permissions for all user files, WordPress allows you to override them. This isn’t something most users need, but it’s there for those who do.

define('FS_CHMOD_FILE', 0644);
define('FS_CHMOD_DIR', 0755);

15 – Allow Automatic WordPress Database Repair

Automated database optimization and maintenance are incorporated into WordPress. This feature, however, is disabled by default.

To activate this function, you can add the following line to your WordPress configuration file.

define('WP_ALLOW_REPAIR', true);

After adding this, you can then use the following URL to optimize and fix the WordPress database.

Automatic WordPress Database Repair Prompt

https://example.com/wp-admin/maint/repair.php

Keep in mind to switch example.com with your own website’s domain name. Repairing or optimizing the database can be done on a single page with a simple set of options. You can access this page without logging in.

16 – Relocating WP-Content Directory

The wp-content directory can be transferred using WordPress. In the opinion of some experts, it can improve WordPress security.

wp-config.php needs to have the following code added:

define( 'WP_CONTENT_DIR', $_SERVER['DOCUMENT_ROOT'] . '/myblog/wp-content' );
define( 'WP_CONTENT_URL', 'https://example/myblog/wp-content');
define( 'WP_PLUGIN_DIR', $_SERVER['DOCUMENT_ROOT'] . '/myblog/wp-content/plugins' );
define( 'WP_PLUGIN_URL', 'https://example/myblog/wp-content/plugins');

Keep in mind to replace example.com with your own website’s domain name. And the myblog directory as well.

17 – Using Custom User Tables

In WordPress, the tables wp_users and wp_usermeta store all user data. You can choose the table where you want to keep your user information using the function below.

define('CUSTOM_USER_TABLE', $table_prefix.'my_users');
define('CUSTOM_USER_META_TABLE', $table_prefix.'my_usermeta');

18 – Making Your WordPress Configuration Files Secure

It’s clear from looking at the wp-config.php file that it contains a lot of crucial WordPress variables. It is usually located in the root WordPress directory, but you can move it.

It can be moved outside your public_html directory, making it inaccessible to others. If the files aren’t in the WordPress root directory, WordPress will automatically check other folders as a fallback option.

You can add the following code to your .htaccess file to restrict access to this wp-config.php file, so you don’t need to move it somewhere else.

<Files wp-config.php>
    order allow,deny
    deny from all
</Files>

Conclusion

As a result of its ease of use, WordPress is the most popular content management system (CMS). One in every three websites on the internet uses WordPress, even those with no prior website development knowledge.

WordPress has a lot of valuable techniques that you may use to make your site better. Don’t be afraid to put the tips we’ve provided to operate and improve your site’s functioning.

If you are looking for one of the best and affordable WordPress hosting services, you can try Rovity. I am sure that you will love our ultra-fast cloud-based WordPress hosting solutions.

Jafar Muhammed

Jafar Muhammed has 10+ years of experience in WordPress, web hosting, domain names, DNS, CDN, server administration, etc. He is an open web advocate. He is the CEO of Rovity, the fastest-growing premium shared hosting startup in India.