WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to add an admin alert that reminds the user to install a certain plugin in case it is missing. I have found a way to generally add an alert box:

function addAlert() { ?>
<script type="text/javascript">
$j = jQuery;
$j('.wrap > h2').parent().prev().after('<div class="update-nag">This is a test alert. Do with it what you want.</div>');
<?php } add_action('admin_head','addAlert');

How do I only make it appear if the plugin is missing? I was thinking about something in the lines of <?php if ( function_exists('...') ) ?> but I am not too sure.

I also need a way of adding a link to the plugin and a link to dismiss the box.

share|improve this question
up vote 1 down vote accepted

To check if a plugin is installed and activated, use the is_plugin_active() function.

Note that you need to include this function first on the front-end before you can use it:

include_once ABSPATH.'wp-admin/includes/plugin.php';

Avoid function_exists() for doing the check. Plugins may refactor their code and a previously existing function might disappear. You never know.

share|improve this answer
Tried this, but I keep getting the following error: Call to undefined function is_plugin_active() What could be causing this? – charlenemasters Dec 11 '12 at 17:03
You need to include it first on the front-end. I'll update my answer. – Geert Dec 11 '12 at 17:04
Thanks it's working! – charlenemasters Dec 11 '12 at 17:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.