WordPress ‘theme directory does not exist’

I’ve been stuck for a few hours trying to figure out why one of the websites I’m currently working on for a client wasn’t working.  I was getting the error below whenever I tried to access the theme customiser…

The theme directory “dark” does not exist.

Now to be fair, this is correct, the theme directory “dark” doesn’t exist in this installation.  But my question was, why is WordPress complaining about this?

I  created a “dark” folder in the themes folder and copied in a child theme which used the selected theme as the parent, and this allowed me to get into the admin dashboard.

Now, to figure out, which took a lot of Googling, and very little success.  Nothing people were suggesting seemed to work at all, or simply didn’t apply.  I was pulling my hair out.  And a thought occurred to me…

To cut a long story short, it turned out that when I added the site theme switcher (that light/dark toggle on the right, unless you’re on a mobile and then it’s at the bottom) I went for the rather generic cookie name “theme”, and it also turns out that the WordPress theme customiser uses this cookie as well.

So, lesson learned, use specific cookie names, even if you’re building your own website, because you never know when a conflict will arise.  And “riklewis_theme” is a lot less likely to collide than simply “theme”.

This is fixed now, but if you’re a fan of the dark theme (like me) you may have seen this revert back to light.  Please be assured this is a one off and normal (dark) service will be resumed if you toggle the theme back.

Time To First Byte – part 2

I often do performance optimisation on WordPress sites for clients, and have recently completed such a project.  One really critical metric I explored is Time To First Byte (TTFB).  But it can be hard to really drill down into it. In my last post I spoke specifically about how to use the Server-Timing response header…

Time To First Byte

I’ve been doing some performance optimisation on a WordPress site recently (something I often do for clients) and was once again asked why I was suggesting a move to a different webhost – am I just trying to earn commission?  Well, in short, no.  Your webhost is actually a really big factor in the overall…

Better Security Pro is coming

Earlier this year I released two new security plugins to the WordPress plugin library; Better Passwords and Better Headers.  I then followed that up a couple of months later with an announcement of a third plugin; Better Detection.  These are all available for free from the WordPress plugin library. Today I am announcing that since then…