• Resolved adejones

    (@adejones)


    Hi, I have ACF:FA installed on a large number of websites and I wanted a way to update from v5 to v6 on all without needing to log in to all dashboards, so I got the following function and put it in a theme update:

    function force_acf_fa_plugin_to_v6() {
    // Force plugin to recognise v6
    update_option('ACFFA_current_version', '6.5.0');
    delete_option('ACFFA_icon_data');
    $settings = array(
    'version' => '6.5.0',
    'use_pro' => false,
    'remove_v4_shims' => true,
    );
    update_option('ACFFA_settings', $settings);
    }
    add_action('after_setup_theme', 'force_acf_fa_plugin_to_v6');

    This seemed to work well, it updated the plugin version in the dashboard, the v6 CSS is enqueued and the icons displaying on the front end are fine.

    I have just noticed however that on the sites when I look at the field, there is a red warning i.e. “Please reselect your FontAwesome Icon.  Style: solid Name:calendar-alt” and if I hover over it says the icon cannot be automatically translated to its v6 equivalent.

    Is there any other function I can use in my next theme update to help with this translation to v6? I think the red warning may alarm a few of my users.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter adejones

    (@adejones)

    Just to answer my own question, the above function was from ChatGPT and I have just been looking in the wp_options table via phpmyadmin and realised that this hasn’t really affected the settings page at all (though it still worked in part), so I have amended to this:

    function force_acf_fa_plugin_to_v6() {
    // Force plugin to recognise v6
    update_option('ACFFA_current_version', '6.5.0');
    delete_option('ACFFA_icon_data');

    // Optional: also update general settings
    $settings = array(
    'acffa_major_version' => '6',
    'acffa_v5_compatibility_mode' => '1',
    'acffa_api_key' => '0',
    'acffa_kit' => '0',
    'acffa_kit_has_pro' => '0'
    );
    update_option('ACFFA_settings', $settings);
    }
    add_action('after_setup_theme', 'force_acf_fa_plugin_to_v6');

    And when I have looked at the ACF FA settings page on one of the websites it now has compatibility mode ticked (which it didn’t before), and looking at one of the field sets the icons are displaying correctly, no errors/warnings.

    Plugin Author Matt Keys

    (@mattkeys)

    Hello @adejones,

    That warning you are trying to get rid of is trying to tell you something important. Basically the ACF field for your FontAwesome no longer knows which icon has been previously selected. So re-saving that page could remove the icon from the front-end.

    I wrote more about why this happens here: https://wordpress.org/support/topic/upgrading-to-fontawesome-6-icons/.

    Matt Keys

    Thread Starter adejones

    (@adejones)

    Thanks Matt, so will that second function I have posted above (which has removed the warning) prevent this from happening?

    Plugin Author Matt Keys

    (@mattkeys)

    Compatibility mode tries to automatically fix the issues you were seeing the warning about. So you may run into far fewer, or perhaps even no remaining icons that couldn’t be fixed automatically.

    But there could still be some icons that couldn’t automatically be resolved which would need to be fixed manually.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Bulk-updating Icon version’ is closed to new replies.