Support

Account

Home Forums ACF PRO Fatal error: call to undefined function is_plugin_active()

Solving

Fatal error: call to undefined function is_plugin_active()

  • I’m seeing the following error after updating to ACF PRO 5.3.3:

    PHP Fatal error: Call to undefined function is_plugin_active() in /var/www/example/public_html/example.com/wp-content/plugins/advanced-custom-fields-pro/pro/core/updates.php on line 121

    It looks as though advanced-custom-fields-pro/pro/core/updates.php is using is_plugin_active() on line 121, which is an admin-only function.

    From line 33 of advanced-custom-fields-pro/pro/acf-pro.php it seems that updates.php will be included outside of the is_admin() conditional, so it’s possible is_plugin_active() may run on the front end:

    acf_include('pro/core/updates.php');

    The example for is_plugin_active shows how to use it on the front-end if required: https://codex.wordpress.org/Function_Reference/is_plugin_active#Examples

    PHP version is 5.5. Host is Netfirms.

  • Getting this too–self-hosted multisite.

  • Hi @nick and @terrence-bogie

    Could one of you open a new ticket here: http://support.advancedcustomfields.com/new-ticket? Please provide the steps to reproduce the issue too.

    Thank you very much 🙂

  • Thanks guys.

    Adding the following to the top of the function should solve the issue:

    
    // ensure is_plugin_active() exists (not on frontend)
    		if( !function_exists('is_plugin_active') ) {
    			
    			include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    			
    		}
    

    Please add this and let me know if it solves the problem for you

    Thanks
    Elliot

  • I added it like this and so far it seems to have fixed the problem.

    		// ensure is_plugin_active() exists (not on frontend)
    		if( !function_exists('is_plugin_active') ) {
    			
    			include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
    			
    		}		
    		
    		// bail early if not a plugin (included in theme)
    		if( !is_plugin_active($basename) ) {
    
    			return $transient;
    			
    		}
    		
    
  • Hi @terrence-bogie

    That is great news.

    I’ll include this in the next version so please keep the code in place for now!

    Thanks
    Elliot

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.