Created
March 6, 2019 18:38
-
-
Save lopadz/82092f2905264f56a712da274704071c to your computer and use it in GitHub Desktop.
Incompatible WP 5 Notice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*====================================== | |
WARNING FOR UPDATES PAGE | |
========================================*/ | |
function wp5_incompatible_notice() { | |
$screen = get_current_screen(); | |
// Make sure we're in the correct page | |
if ( 'update-core' === $screen->id ) { | |
echo '<div class="error notice"> | |
<p>This site is incompatible with <strong>WordPress 5</strong>. <strong>DO NOT UPDATE!</strong></p> | |
</div>'; | |
echo ' | |
<script> | |
jQuery(document).ready( function($) { | |
$("#upgrade").prop("disabled", true); | |
$("#upgrade").removeClass("button-primary").addClass("button-disabled"); | |
}) | |
</script> | |
'; | |
} elseif ( 'dashboard' === $screen->id ) { | |
echo '<div class="error notice"> | |
<p>This site is incompatible with <strong>WordPress 5</strong>. <strong>DO NOT UPDATE!</strong></p> | |
</div>'; | |
} | |
} | |
// Check if the culprit plugin is active | |
if ( in_array( 'multiple-content-blocks/multiple-content-blocks.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { | |
add_action( 'admin_notices', 'wp5_incompatible_notice' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment