is_plugin_active() returning false on active plugin

is_plugin_active() expects just the base name of the plugin as parameter:

So use:

is_plugin_active( 'woocommerce/woocommerce.php' );

The function will use the option 'active_plugins' which is a list of plugins paths relative to the plugin directory already.

On a multi-site installation it will search in get_site_option( 'active_sitewide_plugins') too.

As an implementation note: Avoid these checks. Some users rename plugin names or directories. Test for the functions you will actually use instead, eg:

if ( function_exists( 'woocommerce_get_page_id' ) )
{
    // do something
}

Leave a Comment