Approximate time to read: 2 minutes

As a plugin developer, I donate my time and energies to the WordPress community. I make it clear that I don’t support anyone modifying my code or running it on a non-standard variation of WordPress – this includes forks.

Although not the most popular WordPress fork, ClassicPress is getting a lot of publicity and interest at the moment. And for those developers who may wish to detect the use of this fork, ClassicPress themselves have made this something that is easy to achieve.

Here’s some code that can be used within your theme or plugin code…

This introduces 2 things…

The idea is that, within your plugin, you’d use the is_classicpressfunction to determine if ClassicPress is in use and, if so, not trigger any of your plugin functions – the admin notice is then informing them of why this is. It’s more difficult to achieve the same with a theme, so you’d probably miss out this step and just use the notice to inform the user that the theme isn’t supported on their platform. The notice is non-dismissible for good reason.

  1. A function named is_classicpress – call this to determine if the current CMS being used is ClassicPress (it returns true or false).
  2. An admin notice informing the user that ClassicPress is not supported. The output message defaults to an assumption that this is for a plugin but can be modified to taste.

Right now, ClassicPress is compatible with WordPress, so running plugins and themes under ClassicPress shouldn’t cause any issues. Indeed, you could use this code for detection of ClassicPress for other reasons (altering the code flow to better support ClassicPress, for instance).

Am I picking on ClassicPress here? Not really – it’s just the only major fork that appears to have an easy way to be detected. If you know of any others, please let me know and I’ll add them to this script.

Leave a comment

Talk to me!

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll Up
%d bloggers like this: