Detect If A Particular Theme Is Enabled From The Plugin
-
Hello all.
I’m trying to see if there’s a way to detect if a particular theme is installed and enabled from a plugin. I know that the opposite can be done (detect a plugin from a theme), but is this possible?
I’ve already attempted to define a constant in the theme that I could check if it was defined from the plugin. However, that doesn’t work and I’m pretty sure it’s because the order of how WordPress loads (plugins before themes). So the questions I have are:
1. Can the theme load a constant earlier in the queue?
2. Can the plugin somehow interact with the theme beforehand to see if it’s enabled? (What could be done to see if the theme at least exists on the file system could be to see if the directory exists, but that won’t tell whether the theme is actually the current active theme…right?)
3. Should I use the settings API and store the constant in there upon theme activation so that the plugin could read from the database?
- The topic ‘Detect If A Particular Theme Is Enabled From The Plugin’ is closed to new replies.