Configure Redis on WordPress Website

Category : WordPress

Redis is a fast, open-source key-value data store for use as a database. It reduces the response time of queries hence increasing the speeds of the website. It is a popular choice to reduce the page loading time. In this guide, we are going to configure Redis on WordPress.

Requirements to Configure Redis on WordPress :

  • Redis configured on the server(Installation guide here)
  • Redis path
  • WordPress installed on domain
  • WordPress admin access
  • FTP/ Filemanager access to edit files.

Steps :

  1.  Login to your WordPress – admin account.
  2. Head to the Plugins section and click on Add new, search for Redis in the search bar and install Redis Object cache as shown in the following screenshot.Configure Redis on WordPress
  3. Open the wp-config.php file of your website and add the following code.
    Note: Change the path of your Redis sock file according to your installation.

    // Redis
    define ('WP_REDIS_CLIENT ', 'phpredis');
    define ('WP_REDIS_SCHEME', 'unix');
    define ('WP_REDIS_PATH', '/run/redis/redis.sock');
    define ('WP_REDIS_PORT', 0); Save the file after adding the code.
  4. Head back to wp-admin of your website and activate the Redis plugin.
  5. After enabling the plugin head to settings of Redis and Enable Object Cache.Configure Redis on WordPress
  6. If the path and installation are successful you should be able to see the following screen.Configure Redis on WordPress

Congratulation you have successfully enabled Redis on your WordPress website.

You can Learn basic Redis commands in our article here.