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.
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;
}
That is great news.
I’ll include this in the next version so please keep the code in place for now!
Thanks
Elliot
The topic ‘Fatal error: call to undefined function is_plugin_active()’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.