Tiffany B. Brown

31 August 2015

Fixing the WP_CACHE constant error message with WP Super Cache

TL; DR: Check your line breaks.

One of my recent projects involved upgrading and optimizing a WordPress/BuddyPress-driven site. As part of these optimizations, I installed the WP Super Cache plugin. Like most caching plugins, WP Super Cache generates and serves HTML files to site visitors, instead of retrieving data from the database with every request. It reduces database load and speeds up server response times.

However, during the configuration process, I ran into a snag. After activating the plugin, I saw the following message in the admin panel.

WP_CACHE constant added to wp-config.php

If you continue to see this warning message please see point 5
of the Troubleshooting Guide. The WP_CACHE line must be moved up.

But when I opened wp-config.php, the lines were actually at the beginning of the file (though preceded by a multi-line comment). Odd, right?

Then I looked more closely. Every line ended with ^M. ^M, as it turns out, is a DOS/Windows line ending control character. But this site is running on an Ubuntu Linux server. Following a hunch, I removed all of the ^M characters from the file1, leaving it with Unix/Linux line breaks. When I refreshed the admin screen, the WP_CACHE error message no longer appeared.


  1. I did this manually, because it was quicker than writing a RegEx. If your server has it installed, try the dos2unix utility.