awesome wordpress tricks most wanted wordpress tricks Tech Tutorials wordpress configuration tricks wordpress hacks wordpress tricks wp-config tricks

15 Useful WordPress Configuration Tricks That You May Not Know

Useful WordPress configuration tricks

WP-config is among the strongest information in your WordPress website, and it performs an essential position in how WordPress works behind the scenes. There are some very helpful WordPress configuration tips that the majority newcomers don’t find out about. On this article, we’ll share a few of the most helpful WordPress configuration tips that may assist you troubleshoot, optimize, and safe your WordPress website.

Useful WordPress configuration tricks

How you can Use these WordPress Configuration Tricks?

WordPress comes with a strong configuration file referred to as wp-config.php. It’s situated within the root folder of each WordPress website and incorporates essential configuration settings.

To study extra, see our information on the right way to edit wp-config.php file in WordPress.

All one of the best WordPress internet hosting corporations include 1-click WordPress set up which suggests you’d by no means have to edit the wp-config.php file through the set up. That is the primary cause why many customers are usually not acquainted with the facility of this file.

You can use the wp-config file to troubleshoot, optimize, and safe your WordPress website.

The wp-config.php file is a strong software, and a tiny mistake within the code could make your web site inaccessible. You ought to solely edit this file when essential and all the time create an entire WordPress backup earlier than making any modifications,

That being stated, let’s check out some useful WordPress configuration tips that you should use in your web site.

1. The Primary WordPress Configuration Settings

By default, you simply have to fill within the database settings throughout WordPress set up. When you don’t have a wp-config.php file current, then you may be requested to create one by filling in your database info.

Default WordPress configuration settings

WordPress will attempt to mechanically save these settings by producing a wp-config.php file. Nevertheless, if it fails, then you will want so as to add them manually.

To try this, you’ll need to attach together with your web site utilizing an FTP shopper. As soon as related, you will want to rename the wp-config-sample.php file to wp-config.php.

Rename wp-config-sample.php file

After that, you’ll be able to go forward and edit the newly created wp-config.php file. You might want to add your database info by altering the next strains:


outline(‘DB_NAME’, ‘database-name’);
outline(‘DB_USER’, ‘database-username’);
outline(‘DB_PASSWORD’, ‘database-password’);
outline(‘DB_HOST’, ‘localhost’);

Don’t overlook to save lots of your modifications and add the file again to the server.

2. Including Safety Keys in WordPress

The default WordPress set up routinely provides safety keys to your configuration file. These safety keys are used so as to add an additional safety layer to your WordPress login and cookie authentication.

You can all the time regenerate safety keys in the event you really feel somebody could also be accessing your web site with out correct authentication. Altering safety keys will sign off all logged in customers.


outline( ‘AUTH_KEY’, ‘put your distinctive phrase right here’ );
outline( ‘SECURE_AUTH_KEY’, ‘put your distinctive phrase right here’ );
outline( ‘LOGGED_IN_KEY’, ‘put your distinctive phrase right here’ );
outline( ‘NONCE_KEY’, ‘put your distinctive phrase right here’ );
outline( ‘AUTH_SALT’, ‘put your distinctive phrase right here’ );
outline( ‘SECURE_AUTH_SALT’, ‘put your distinctive phrase right here’ );
outline( ‘LOGGED_IN_SALT’, ‘put your distinctive phrase right here’ );
outline( ‘NONCE_SALT’, ‘put your distinctive phrase right here’ );

For extra info, see our article on WordPress safety keys and the right way to use them.

three. Change WordPress Desk Prefix

A typical default WordPress set up provides a wp_ prefix to all WordPress database desk names. Some WordPress safety specialists consider that altering the desk prefix could make your WordPress database safer.

To try this you, want to vary the next line in your WordPress configuration.


$table_prefix = ‘wp_’;

In case you are doing this for an present web site, then additionally, you will want to vary the desk prefix in your WordPress database. To try this, see our article on learn how to change the WordPress database prefix.

four. Activate Debugging in WordPress

WordPress comes with a neat debugging function that permits you to see or disguise WordPress errors when in debug mode. To show this on, you will have so as to add this rule in your WordPress configuration file.


outline( ‘WP_DEBUG’, true );

You can even activate debugging whereas hiding the errors in your web site and saving them in a log file as an alternative. To try this, add the next strains to your configuration settings.


outline( ‘WP_DEBUG’, true );
outline( ‘WP_DEBUG_LOG’, true );
outline( ‘WP_DEBUG_DISPLAY’, false );

This can create a debug.log file inside wp-content folder of your web site and retailer all debugging errors and notices contained in the log file.

5. Altering Your Website or WordPress Tackle

Usually, you’ll be able to set your WordPress and Website URLs from Settings » Basic web page. Nevertheless, you could not be capable of do this for those who don’t have entry to your WordPress website, seeing redirect errors, or have simply moved your website.

In that case, you possibly can change your website and WordPress URLs by way of wp-config.php file by including the next strains:


outline(‘WP_HOME’, ‘http://www.example.com’);
outline(‘WP_SITEURL’, ‘http://www.example.com’);

Don’t overlook to switch instance.com with your personal area identify.

6. Override File Permissions

WordPress lets you override file permissions in case your host has restrictive permissions for all consumer information. Most customers don’t want this, however it exists for many who want it.


outline(‘FS_CHMOD_FILE’, 0644);
outline(‘FS_CHMOD_DIR’, 0755);

To study extra about file permissions, see our article on how-to repair file and folder permissions error in WordPress.

7. Altering Publish Revision Settings

WordPress has a really helpful a publish revisions function which lets you undo modifications to your posts and pages by reverting again to a earlier model or an autosave.

You can disable or change submit revision settings via the configuration file. Listed here are totally different submit revision settings that you should use.

You can change how typically WordPress shops an autosave as a revision by including the next line:


outline(‘AUTOSAVE_INTERVAL’, 120); // in seconds

Some articles in your website might have dozens of publish revisions relying on how lengthy it took to write down them. In the event you assume that function annoys you, then you’ll be able to restrict the variety of revisions per publish.


outline(‘WP_POST_REVISIONS’, 10);

If for some cause, you need to disable the submit revisions function altogether (not advisable in any respect), then you should use the next code to disable publish revisions.


outline( ‘WP_POST_REVISIONS’, false );

eight. Altering WordPress Trash Settings

WordPress comes with a recycle bin function referred to as Trash. When a consumer sends a publish to trash, it’s nonetheless saved in your web site for subsequent 30 days as trash. After that point, WordPress mechanically deletes them ceaselessly.

You can change this conduct by altering the variety of days you need to maintain the trash.


outline( ‘EMPTY_TRASH_DAYS’, 15 ); // 15 days

If you don’t like this function, then you’ll be able to disable it by including the perform under:


outline(‘EMPTY_TRASH_DAYS’, zero );

Observe: Utilizing zero means your posts can be deleted completely. WordPress wouldn’t ask for affirmation whenever you click on on Delete Completely. Any unintentional click on might value you…

To study extra, see our article on the best way to restrict or disable automated empty trash function in WordPress.

9. Including FTP/SSH Constants to WordPress Configuration

By default, WordPress lets you improve WordPress core, themes, and plugins from the admin dashboard. There are some hosts that require an FTP or SSH connection everytime you attempt to improve, or set up a brand new plugin.

WordPress asking for FTP information

Through the use of the codes, you possibly can set the FTP or SSH constants and by no means have to fret about it once more.


// forces the filesystem technique: “direct”, “ssh”, “ftpext”, or “ftpsockets”
outline(‘FS_METHOD’, ‘ftpext’);
// absolute path to root set up listing
outline(‘FTP_BASE’, ‘/path/to/wordpress/’);
// absolute path to “wp-content” listing
outline(‘FTP_CONTENT_DIR’, ‘/path/to/wordpress/wp-content/’);
// absolute path to “wp-plugins” listing
outline(‘FTP_PLUGIN_DIR ‘, ‘/path/to/wordpress/wp-content/plugins/’);
// absolute path to your SSH public key
outline(‘FTP_PUBKEY’, ‘/house/username/.ssh/id_rsa.pub’);
// absolute path to your SSH personal key
outline(‘FTP_PRIVKEY’, ‘/house/username/.ssh/id_rsa’);
// both your FTP or SSH username
outline(‘FTP_USER’, ‘username’);
// password for FTP_USER username
outline(‘FTP_PASS’, ‘password’);
// hostname:port combo on your SSH/FTP server
outline(‘FTP_HOST’, ‘ftp.instance.org:21’);

Notice: Don’t overlook to exchange the WordPress path and ftp.instance.com with your personal FTP Host info.

10. Permit Automated Database Restore

WordPress comes with a built-in function to routinely optimize and restore WordPress database. Nevertheless, this function is turned off by default.

To allow this function you’ll want to add the next line to your WordPress configuration file.


outline(‘WP_ALLOW_REPAIR’, true);

After including this, that you must go to the next URL to optimize and restore WordPress database

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

Don’t overlook to exchange instance.com with your personal area identify. You will see a easy web page with the choices to restore or restore and optimize the database. You don’t must be logged in to entry this web page.

Optimize and repair WordPress database

11. Improve PHP Reminiscence Restrict

A number of the commonest WordPress errors are brought on by PHP reminiscence exhausted. You can improve the PHP reminiscence restrict by means of wp-config.php file. Merely paste the code under:


outline(‘WP_MEMORY_LIMIT’, ‘128M’);

12. Shifting wp-content Listing

WordPress lets you transfer your wp-content listing. Some specialists consider that it will possibly assist strengthen WordPress safety.

You might want to add the next code to your wp-config.php file:


outline( ‘WP_CONTENT_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/weblog/wp-content’ );
outline( ‘WP_CONTENT_URL’, ‘http://example/blog/wp-content’);
outline( ‘WP_PLUGIN_DIR’, $_SERVER[‘DOCUMENT_ROOT’] . ‘/weblog/wp-content/plugins’ );
outline( ‘WP_PLUGIN_URL’, ‘http://example/blog/wp-content/plugins’);

Don’t overlook to switch instance.com with your personal area identify.

13. Use Customized Consumer Tables

By default, WordPress saves all consumer knowledge within the tables wp_users and wp_usermeta. Through the use of the perform under, you possibly can specify the desk the place you need your consumer info saved.


outline(‘CUSTOM_USER_TABLE’, $table_prefix.’my_users’);
outline(‘CUSTOM_USER_META_TABLE’, $table_prefix.’my_usermeta’);

14. Allow Multi-Website Community

Every WordPress website comes with a built-in multisite function which lets you create a number of WordPress websites utilizing the identical set up. To study extra, see our full information on the best way to set up and setup WordPress multisite community.

You can allow multisite performance by including the next line to your WordPress configuration file:


outline(‘WP_ALLOW_MULTISITE’, true);

15. Securing Your WordPress Configuration File

As you’ll be able to see, the wp-config.php file incorporates actually essential WordPress settings. By default it’s situated within the root WordPress folder, however you possibly can transfer it. It may be moved outdoors your public_html listing, so customers can’t entry it. WordPress is aware of by default to look in different directories if the information shouldn’t be discovered within the WordPress root folder.

You also can add the next code to your .htaccess file to restrict entry to this file.


# Shield wp-config.php
<Information wp-config.php>
order permit,deny
deny from all
</Information>

We hope this text helped you study some helpful WordPress configuration tips that you simply didn’t know. You may need to see our mega record of 55+ most needed WordPress ideas, tips, and hacks that you should use in your website.

In case you appreciated this text, then please subscribe to our YouTube Channel for WordPress video tutorials. You may also discover us on Twitter and Fb.

(perform()
var fbds = doc.createElement(‘script’);
fbds.async = true;
fbds.src = ‘//join.fb.internet/en_US/fbds.js’;
var s = doc.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(fbds, s);
_fbq.loaded = true;

_fbq.push([‘addPixelId’, ‘831611416873998’]);
)();
window._fbq = window._fbq || [];
window._fbq.push([‘track’, ‘PixelInitialized’, ]);