Thursday, December 3, 2020
Home Blogging 15 Useful WordPress Configuration Tricks That You May Not Know

15 Useful WordPress Configuration Tricks That You May Not Know

WP-config is likely one of the strongest recordsdata in your WordPress web site, and it performs an essential position in how WordPress works behind the scenes. There are some very helpful WordPress configuration methods that the majority novices don’t learn about. On this article, we are going to share a few of the most helpful WordPress configuration methods that may assist you to troubleshoot, optimize, and safe your WordPress web site.

The best way to Use these WordPress Configuration Tips?

WordPress comes with a strong configuration file known as wp-config.php. It’s situated within the root folder of each WordPress web site and accommodates essential configuration settings.

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

All of the greatest WordPress internet hosting corporations include 1-click WordPress set up which implies you’ll by no means must edit the wp-config.php file throughout the set up. That is the principle cause why many customers usually are not aware of the facility of this file.

You should use the wp-config file to troubleshoot, optimize, and safe your WordPress web site.

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

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

1. The Fundamental WordPress Configuration Settings

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

WordPress will attempt to robotically save these settings by producing a wp-config.php file. Nonetheless, if it fails, then you’ll need 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’ll need to rename the wp-config-sample.php file to wp-config.php.

After that, you possibly can go forward and edit the newly created wp-config.php file. You will want so as to add your database data by altering the next traces:

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

2. Including Safety Keys in WordPress

The default WordPress set up robotically 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 possibly can all the time regenerate safety keys in case you really feel somebody could also be accessing your web site with out correct authentication. Altering safety keys will log off all logged in customers.

define( 'AUTH_KEY',         'put your unique phrase here' );
define( 'SECURE_AUTH_KEY''put your unique phrase here' );
define( 'LOGGED_IN_KEY',    'put your unique phrase here' );
define( 'NONCE_KEY',        'put your unique phrase here' );
define( 'AUTH_SALT',        'put your unique phrase here' );
define( 'SECURE_AUTH_SALT', 'put your unique phrase here' );
define( 'LOGGED_IN_SALT',   'put your unique phrase here' );
define( 'NONCE_SALT',       'put your unique phrase here' );

For extra data, see our article on WordPress safety keys and use them.

3. Change WordPress Desk Prefix

A typical default WordPress set up provideswp_ prefix to all WordPress database desk names. Some WordPress safety specialists imagine 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 current web site, then additionally, you will want to vary the desk prefix in your WordPress database. To try this, see our article on  change the WordPress database prefix.

4. Activate Debugging in WordPress

WordPress comes with a neat debugging function that means that you can see or disguise WordPress errors when in debug mode. To show this on, you’ll need so as to add this rule in your WordPress configuration file.

define( 'WP_DEBUG', true );

You may also 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 traces to your configuration settings.

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

It will 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 possibly can set your WordPress and Website URLs from Settings » Basic web page. Nonetheless, you might not have the ability to try this in case you don’t have entry to your WordPress web site, seeing redirect errors, or have simply moved your web site.

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

define('WP_HOME', '');
define('WP_SITEURL', '');

Don’t overlook to switch with your individual area title.

6. Override File Permissions

WordPress means that you can override file permissions in case your host has restrictive permissions for all consumer recordsdata. Most customers don’t want this, nevertheless it exists for many who want it.

define('FS_CHMOD_FILE', 0644);
define('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 helpfulput up revisions function which lets you undo adjustments to your posts and pages by reverting again to a earlier model or an autosave.

You possibly can disable or change put up revision settings by the configuration file. Listed below are totally different put up revision settings that you should use.

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

define('AUTOSAVE_INTERVAL', 120); // in seconds

Some articles in your web site might have dozens of put up revisions relying on how lengthy it took to put in writing them. When you suppose that function annoys you, then you possibly can restrict the variety of revisions per put up.

define('WP_POST_REVISIONS', 10);

If for some cause, you wish to disable the put up revisions function altogether (not really helpful in any respect), then you should use the next code to disable put up revisions.

define( 'WP_POST_REVISIONS', false );

8. Altering WordPress Trash Settings

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

You possibly can change this habits by altering the variety of days you wish to preserve the trash.

define( 'EMPTY_TRASH_DAYS', 15 ); // 15 days

If you don’t like this function, then you possibly can disable it by including the perform under:

define('EMPTY_TRASH_DAYS', 0 );

Be aware: Utilizing zero means your posts can be deleted completely. WordPress wouldn’t ask for affirmation if you click on on Delete Completely. Any unintended click on may price you…

To study extra, see our article on  restrict or disable computerized empty trash function in WordPress.

You May Also Like : How to Create a BuzzFeed Like Website Using WordPress

9. Including FTP/SSH Constants to WordPress Configuration

By default, WordPress means that you can 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.

By utilizing 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 method: "direct", "ssh", "ftpext", or "ftpsockets"
define('FS_METHOD', 'ftpext');
// absolute path to root installation directory
define('FTP_BASE', '/path/to/wordpress/');
// absolute path to "wp-content" directory
define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/');
// absolute path to "wp-plugins" directory
define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/');
// absolute path to your SSH public key
define('FTP_PUBKEY', '/home/username/.ssh/');
// absolute path to your SSH private key
define('FTP_PRIVKEY', '/home/username/.ssh/id_rsa');
// either your FTP or SSH username
define('FTP_USER', 'username');
// password for FTP_USER username
define('FTP_PASS', 'password');
// hostname:port combo for your SSH/FTP server
define('FTP_HOST', '');

Be aware: Don’t overlook to switch the WordPress path and with your individual FTP Host data.

10. Permit Computerized Database Restore

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

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

define('WP_ALLOW_REPAIR', true);

After including this, you might want to go to the next URL to optimize and restore WordPress database

Don’t overlook to switch with your individual area title. You will note a easy web page with the choices to restore or restore and optimize the database. You don’t have to be logged in to entry this web page.

11. Improve PHP Reminiscence Restrict

A few of the most typical WordPress errors are brought on by PHP reminiscence exhausted. You possibly can improve the PHP reminiscence restrict by wp-config.php file. Merely paste the code under:

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

12. Shifting wp-content Listing

WordPress means that you can transfer your wp-content listing. Some specialists imagine that it might probably assist strengthen WordPress safety.

You will want so as to add the next code to your wp-config.php file:

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

Don’t overlook to switch with your individual area title.

13. Use Customized Person Tables

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

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

14. Allow Multi-Website Community

Every WordPress web site 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  set up and setup WordPress multisite community.

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

define('WP_ALLOW_MULTISITE', true);

15. Securing Your WordPress Configuration File

As you possibly can see, the wp-config.php file accommodates 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 not entry it. WordPress is aware of by default to look in different directories if the recordsdata shouldn’t be discovered within the WordPress root folder.

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

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

We hope this text helped you study some helpful WordPress configuration methods that you simply didn’t know. You may additionally wish to see our mega listing of 55+ most wished WordPress suggestions, methods, and hacks that you should use in your web site.

If you liked this article, make sure to hit the bell for getting our latest updates and share this article with your friends in every social media platforms.



Please enter your comment!
Please enter your name here

- Advertisment -

Most Popular

LIC Premium Paid Certificate Download For Income Tax Purpose – Online

You should be conscious that it's necessary to provide Premium Paid Certificate for insurance coverage insurance policies to avail Income tax exemption profit underneath...

Leave Encashment Calculation & Tax Implications

Leave Encashment is a course of the place you may get cash for the unused stability leaves. Most of the persons are not conscious...

Rakesh Jhunjhunwala Portfolio Holdings

Rakesh Jhunjhunwala, 60, India’s most profitable fairness investor who made 2.9 Billion {dollars} (290 crores USD) ranging from $100. Rakesh Jhunjhunwala is a clever man with...

Angel Broking Vs Zerodha Broker Comparison : Brokerage, Margin, Charges

I've carried out the comparability between Angel Broking vs Zerodha (a reduction dealer) on this article. If you might be on the lookout for advisory dealer...

Recent Comments