Skip to content

Commit faed5e2

Browse files
committed
Add notice explaining what has happened when the plugin is deactivated
1 parent a514a38 commit faed5e2

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

code-snippets.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,16 @@
3737
if ( defined( 'CODE_SNIPPETS_FILE' ) ) {
3838
require_once ABSPATH . 'wp-admin/includes/plugin.php';
3939
deactivate_plugins( array( 'code-snippets/code-snippets.php' ), true );
40+
41+
if ( ! function_exists( 'code_snippets_deactivated_old_version_notice' ) ) {
42+
function code_snippets_deactivated_old_version_notice() {
43+
echo '<div class="error fade"><p>',
44+
esc_html__( 'Another version of Code Snippets appears to be installed. Deactivating this version.', 'code-snippets' ),
45+
'</p></div>';
46+
}
47+
}
48+
49+
add_action( 'admin_notices', 'code_snippets_deactivated_old_version_notice', 11 );
4050
return;
4151
}
4252

0 commit comments

Comments
 (0)