Have error after update
Fatal error: Uncaught Error: Call to undefined function acf_add_admin_notice() in /home/domain.site/wp-content/plugins/advanced-custom-fields-pro/pro/api/api-pro.php:330
Hi @tuskotrush
This is weird. Could you please make sure that you have the set the license correctly? Could you please deactivate and reactivate the license?
Also, it’s possible that the installation is corrupted. Could you please manually reinstall ACF and see if it fixes the issue? You can download the latest version of ACF from https://www.advancedcustomfields.com/my-account/.
It’s also possible that there’s a conflict on your site. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.
If the issue persists, could you please open a new ticket and provide temporary admin credentials to your site? You can open a new ticket here: https://support.advancedcustomfields.com/new-ticket. Also, please don’t forget to explain the issue again and provide the link to this thread.
Thanks 🙂
function wpa__prelicense() {
if( function_exists('acf_pro_is_license_active') && !acf_pro_is_license_active() ) {
$args = array(
'_nonce' => wp_create_nonce('activate_pro_licence'),
'acf_license' => base64_encode('MY_LICENSE_STRING'),
'acf_version' => acf_get_setting('version'),
'wp_name' => get_bloginfo('name'),
'wp_url' => home_url(),
'wp_version' => get_bloginfo('version'),
'wp_language' => get_bloginfo('language'),
'wp_timezone' => get_option('timezone_string'),
);
$response = acf_pro_get_remote_response( 'activate-license', $args );
$response = json_decode($response, true);
if( $response['status'] == 1 ) {
acf_pro_update_license($response['license']);
}
}
}
add_action( 'after_setup_theme', 'wpa__prelicense' );
That code worked before an update to 5.5.0 & error are visible with qTranslate, when I changed the language to NOT default.
You can see error here http://trachuk.dev0.site/en/
Hi @tuskotrush
First, you need to remove the base64_encode()
function so it looks like this:
'acf_license' => 'MY_LICENSE_STRING',
Also, did you include ACF in your theme? It’s possible that the code is executed before ACF is loaded. In this case, could you please use the acf/init hook instead?
I hope this helps 🙂
Hi @james
This code fix it:
if(!function_exists('acf_add_admin_notice')) {
function acf_add_admin_notice( $text, $class = '', $wrap = 'p' ) {
// vars
$admin_notices = acf_get_admin_notices();
// add to array
$admin_notices[] = array(
'text' => $text,
'class' => "updated {$class}",
'wrap' => $wrap
);
// update
acf_update_setting( 'admin_notices', $admin_notices );
// return
return ( count( $admin_notices ) - 1 );
}
}
if(!function_exists('acf_get_admin_notices')) {
function acf_get_admin_notices() {
// vars
$admin_notices = acf_get_setting( 'admin_notices' );
// validate
if( !$admin_notices )
{
$admin_notices = array();
}
// return
return $admin_notices;
}
}
But it isn’t a solution 🙁
5.5 database update caused fields on select pages to disappear (entirely, there’s no record of them even in revisions), but oddly, only in selected places.
I’m using the same field set on a custom post type and pages. In 98% of the places, its fine. But it deleted the field entries from 2 CPT posts.
Thoughts?
I’m seeing similar issues. My date picker fields will select and show the date, but upon saving they vanish. Existing entries have lost the date that was there.
Hi @tuskotrush
Have you tried to change the hook? Also, could you please try the solution I gave you before. If that doesn’t work, I think the best way to investigate it is for you to open a new ticket and provide temporary admin credentials to your staging/development site. You can open a new ticket here: https://support.advancedcustomfields.com/new-ticket. Also, please don’t forget to explain the issue again and provide the link to this thread.
Maybe the update process was interrupted, somehow, so the fields are not converted correctly. Could you please check the difference between the posts that have the fields deleted and the ones that are not on the wp_postmeta
table?
It’s possible that there’s a JS conflict on your site. Could you please try to reproduce the issue on one of the WordPress’ stock themes (like Twenty Sixteen) with other plugins deactivated? If it disappears, then you can activate the theme and plugins one by one to see which one causes the issue.
Thanks 🙂
@james
Thanks!
I’ve fixed it, just changed add_action( 'after_setup_theme', 'wpa__prelicense' );
->
add_action( 'admin_init', 'wpa__prelicense', 99 );
@hzp I’ve had the same problem and support say there’s no known data loss issue – but that isn’t borne out by what I see with 5.5.0.
The topic ‘ACF Pro 5.5.0’ 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.