A WordPress plugin update fix

An AI generated image of a man holding a giant plug, looking at his watch

For a little while now, I’ve had some issues with installing and updating plugins in WordPress. Trying to do either of these tasks has resulted in the process hanging for a long time, and then eventually failing. As a side effect, the Site Health screen would never load – it was just sit there for minutes at a time, but never timing out. Which was frustrating, as I was hoping that Site Health would give me some clues as to why my site wasn’t, well, healthy.

Eventually, I dug into my wp-config.php file. I’ve edited mine a bit, to add some FTP credentials and define the home page and site URL. This offers a marginal performance improvement as it reduces the number of database calls your site needs to make. With my FTP credentials was this line:

define('FS_METHOD', 'ftpext');

It turns out that I probably shouldn’t have that line there. I commented it out, as below:

/* define('FS_METHOD', 'ftpext'); */

And suddenly everything worked again. Huzzah!

According to the documentation, you probably don’t need to have this in your wp-config.php file and removing it can solve problems. Having it there forces WordPress to use a particular method for interacting with your host’s file system, but by default WordPress should choose the correct method automatically.

I’m guessing it was in there after I copied and pasted some code from somewhere else, without knowing what it did. Which is a reminder that just copying someone else’s code without understanding it is not a good idea.