-1

When I try to access the details on a product using WooCommerce I get this error message.

Fatal error: Call to undefined function is_plugin_active() in /home2/samiam/public_html/wp-content/plugins/featured-image-from-url/includes/thumbnail.php on line 55

This is the code that is sitting right over this line.

function fifu_get_html($url, $alt) {
    if (is_plugin_active('sirv/sirv.php') && strpos($url, "sirv.com") !== false)
        return sprintf(' ', $url);

return sprintf('<!-- Featured Image From URL plugin --> <img src="%s" alt="%s"></img>', $url, $alt);}<code>

Any suggestions will help thanks!

The site is fratzkeart.com

When you try to access one of the products it shows this error from the WooCommerce product page... this worked not to long ago I think an update broke it. Here is one of the products URLS >> fratzkeart.com/index.php/product/solo-paper/

  • Maybe you are calling this file directly instead through the WP API? In that case, none of the WP functions are available. – fuxia Nov 18 '16 at 6:23
  • Also, is_plugin_active() is loaded only in WP admin area.returning. So, how and when do you execute that function? – cybmeta Nov 18 '16 at 7:18
  • 1
    In is_plugin_active is call from front-end you need to include plugin.php file as mention here codex.wordpress.org/Function_Reference/is_plugin_active – Benoti Nov 18 '16 at 7:50
  • @toscho♦ How would I know that I was calling it directly the site is accessing this php. So I'm pretty sure I am calling it through a WP API as you can see through the site that I exampled. – OverBakedToast Nov 18 '16 at 19:50
  • 1
    @cybmeta, agree with you – Benoti Nov 19 '16 at 9:07
1

You can try this, it works for me :)

// We need plugin.php!
        require_once( ABSPATH . 'wp-admin/includes/plugin.php' );

        $plugins = get_plugins();

        foreach ($plugins as $key => $value) {
            if ( $value['Name'] == 'Aest Plugins' ) { // <-- name plugin validate
                if( is_plugin_active( $key ) ){
                    echo "plugin {$value['Name']} is active";   
                }else{
                    echo "plugin {$value['Name']} is desactive";    
                }
            }
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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