If you start searching, you will find that quite a lot of people running WordPress have a strange habit of suddenly finding their GUI or ‘visual editor’ has stopped working. Usually, they can still type hand-crafted HTML, but the visual editor just appears blank, dead and useless.
And that happened to me just this week for no apparent reason, and so I did do that search …and found a bazillion suggestions, none of which worked. Most consisted of :
- Try a different browser -I was merely able to confirm that the visual editor was broken in IE, Edge, Firefox and Chrome.
- De-activate all plugins -I did that. Even deleted all plugins. I even renamed the plugin directory to plugin.old, so the WordPress dashboard declared I had no plugins at all installed. The visual editor remained broken and still complained about the inability to load two files from the tinymce advanced plugin directory.
- Clear browser cache -I did so repeatedly. Everything was still broken.
By switching on the Firefox developer tools, I could see two ‘failed to load’ errors were happening right at the point where the TinyMCE GUI toolbar should get displayed. Naturally, I neglected to note down precisely what two files it couldn’t load, but they were along the lines of wordpress/wp-includes/js/tinymce/plugins/wpembed/plugin.min.js and wordpress/wp-includes/js/tinymce/plugins/wpgallery/plugin.min.js. Naturally, I verified that both of those files actually existed and had the correct permissions and ownership set… all was fine in that regard.
I think the most bizarre bit was the fact that the Firefox developer tools showed these two files failed to load even when every single plugin had been deleted. Something still wanted to load the tinymce advanced plugin scripts, even though nothing could possibly warrant it. A mystery, then.
Now I’ll back up a bit: I’m self-hosted and have been aware of a lot of attempts to log on to my server via SSH -mostly from China, so if you are responsible for server 18.104.22.168 (to pick just one of many), which is registered as belonging to Chinanet Jiangxi province network, No. 31 jingrong street Beijing 100032, please stop trying!
To combat this, I recently ramped up my fail2ban configuration: you attempt an SSH login now and fail 5 times in 10 minutes, and I ban your entire IP address from all contact with my server for 6 months. Previously, the rule was that you’d only be banned for an hour… and that meant people were constantly re-trying and the resulting flood of notifications about invalid ssh logins was driving me bonkers. By upping the ban time, it means that an IP address gets added to my routing table as being ‘denied all’ and stays there for a long time. Accordingly, the number of IP addresses in my firewall rules ballooned: when I last checked, some 134 IP addresses had been added to my list of banned IPs.
I also added the WP Fail2ban plugin to my site: this sets up IP blocks if someone repeatedly attempts to log into your WordPress installation as the administrator. I had about 15 of them turn up in the space of a week, too: the Internet can be a nasty place! But anyway: that’s another 15 IP addresses falling under the long-term ban-hammer.
And this afternoon, the penny dropped: about the only thing that had changed on my server from the time the WordPress Visual Editor worked to the time it stopped working was this explosion in the number of banned IP addresses thanks to my fail2ban re-configurations.
So I just did a service iptables stop and a swift service iptables start. That has the effect of wiping all previously-stored routing table rules -in other words, my list of banned IP addresses was wiped. And Lo! The Visual Editor started working once more (allowing me to type this, in fact).
I can’t begin to explain what’s going on here, but it’s very annoying. For starters, the errors saying that it couldn’t load the various tinymce java script files were displayed even though I’d deleted all plugins, and cleared my browser cache entirely. Why something would continue to reference a tinymce plugin directory/file when the entire plugin had been wiped, I have no idea -but it doesn’t sound like best practice to me!
Second, why would anything about the tinymce advanced plugin fail to work because some IP addresses were blocked by my firewall? What possible relationship is there between a visual editor toolbar and needing to try an ssh login to my webserver or to try a WordPress administrator’s log in? That doesn’t pass the sniff test with me.
But anyway: I’ll leave speculation about precisely what’s going on until the next time I encounter the problem and do my research a little more carefully. For now, all I can do is to add to the pile of suggestions that are made whenever this problem is asked about on the forums: switch your firewall off and on. It did the trick for me in an instant.
And when/if it happens again, I’ll take proper screenshots!