Check if Recipe Hero is active

If you’re building a plugin the relies on Recipe Hero, such as an extension, you may want to check on activation if Recipe Hero is active and if it’s not, display a notice warning that Recipe Hero is required.

You could use something like this:

On the other hand, you could also just check if the main RecipeHero class exists, but this isn’t full-proof (but neither is the method above).

Alternatively, if you were building a theme for example, you may have specific Recipe Hero functionality that is only useful when Recipe Hero is active.

To check for it, create a function like:

So you could check for Recipe Hero like so: