Skip to content

Instantly share code, notes, and snippets.

@dartiss

dartiss/wp_fork_detect.php

Last active Dec 31, 2019
Embed
What would you like to do?
WordPress fork detection
<?php
/**
* WordPress fork detection
*
* Check if a WordPress fork is in use. The check is a seperate function, instead of simply using the current function_exists
* in case the method of detection needs to change.
*/
function is_fork() {
$fork = false;
if ( function_exists( 'calmpress_version' ) ) { $fork = 'calmPress'; }
if ( function_exists( 'classicpress_version' ) ) { $fork = 'ClassicPress'; }
return $fork;
}
/**
* Show fork message
*
* Display a message, if user is using a WordPress fork
*/
function fork_admin_message() {
echo '<div class="notice notice-error"><p>' . __( '[Plugin name] does not support forks of WordPress. Please disable the plugin or consider switching to WordPress.', 'sample-text-domain' ) . '</p></div>';
}
add_action( 'admin_notices', 'fork_admin_message' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment