0

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.

  • WordPress can't read 'old versions' of the file. Make sure you uploaded the right file to the right place and that it was successful. – Jacob Peattie Nov 2 '17 at 3:29
  • @JacobPeattie yes, I have verified that the most recent version of functions.php is uploaded. – Naltroc Nov 2 '17 at 3:38
0

The issue was indeed server side caching. Bluehost was very helpful in providing a way to fix it via FTP. Do the following:

In the /wp-content/mu-plugins directory, there is a file called endurance-browser-cache.php. By renaming the file, for example to endurance-browser-cache.old, visiting the site, and returning the name to endurance-browser-cache.php, WordPress will have had to force refresh the cache.

Good to know!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.