Last active
February 16, 2021 06:15
-
-
Save ramiy/62c34ffa30fcafbfd279b1a77b4dfeb2 to your computer and use it in GitHub Desktop.
Check if Elementor is installed and activated
This file contains 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
public function admin_notice_missing_main_plugin() { | |
if ( isset( $_GET['activate'] ) ) unset( $_GET['activate'] ); | |
$message = sprintf( | |
/* translators: 1: Plugin Name 2: Elementor */ | |
esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'text-domain' ), | |
'<strong>' . esc_html__( 'Plugin Name', 'text-domain' ) . '</strong>', | |
'<strong>' . esc_html__( 'Elementor', 'text-domain' ) . '</strong>' | |
); | |
printf( '<div class="notice notice-warning is-dismissible"><p>%1$s</p></div>', $message ); | |
} | |
if ( ! did_action( 'elementor/loaded' ) ) { | |
add_action( 'admin_notices', 'admin_notice_missing_main_plugin' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you need to do this after plugin is loaded. so check it on add action, plugin_loaded. otherwise this will fail