Skip to content

Instantly share code, notes, and snippets.

@ramiy
Last active February 16, 2021 06:15
Show Gist options
  • Save ramiy/62c34ffa30fcafbfd279b1a77b4dfeb2 to your computer and use it in GitHub Desktop.
Save ramiy/62c34ffa30fcafbfd279b1a77b4dfeb2 to your computer and use it in GitHub Desktop.
Check if Elementor is installed and activated
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' );
}
@latheeshvm
Copy link

you need to do this after plugin is loaded. so check it on add action, plugin_loaded. otherwise this will fail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment