WordPress reading old version of php file, breaks site
I added a function to the child theme functions.php
to check if a plugin class exists. The code was something like
function check_class_exists() {
if (class_exists('classname')) {
echo "class exists";
} else {
echo "does not exist";
}
}
check_class_exists();
It did the job, then threw a ‘headers already sent error,’ which is reasonable. I removed the function from the file and re uploaded it to the server. The same error message exists, and prints the line where the previously existing function was. Here is the error message:
Warning: Cannot modify header information – headers already sent by (output started at /home1/drstevf1/public_html/cyrenelabs/wp-content/themes/divi-child/functions.php:275) in /home1/drstevf1/public_html/cyrenelabs/wp-includes/pluggable.php on line 1210
The function php is only 267 lines now – there is now way it can call that function!
How can I ensure that WordPress reads the most recent version of the file? I only have FTP access.
1
Answers
The issue was indeed server side caching. Bluehost was very helpful in providing a solution via FTP.
In the /wp-content/mu-plugins directory, there is a file called
endurance-browser-cache.php
. By renaming the file, for example toendurance-browser-cache.old
, visiting the site, and returning the name toendurance-browser-cache.php
, WordPress will have had to force refresh the cache.Good to know!