ACF Fields not working

After installing WP ACF-VC Bridge plugin with Kalium theme, you’ll see admin notice that you can disable your free Advanced Custom Fields plugin and enjoy ACF PRO version. However, after disabling the plugin you may encounter problem with your ACF fields. The problem comes from Kalium’s ACF compatibility class. Particularly, then provide some functions if ACF plugin is not installed. The thing is that the code doesn’t check if ACF PRO plugin is active. Under /wp-content/themes/kalium/inc/classes/compatibility/kalium-acf.php file, you’ll find this code:

$this->acf_installed = kalium()->helpers->isPluginActive( 'advanced-custom-fields/acf.php' ) && function_exists( 'get_field' );

Evidently, this code may detect only Free ACF version and it can’t detect ACF PRO, which is installed under advanced-custom-fields-pro folder in plugins directory nor it can detect ACF PRO if it was shipped inside some plugin as it is in case with WP ACF-VC Bridge plugin.

Solution is to add the following code anywhere to your child theme’s functions.php or if you don’t have child theme, then you need to modify Kalium’s functions.php and add the code to the very top of the file, just right before Kalium loads its classes. The code is:

add_filter( 'kalium_load_classes', 'disable_kalium_acf_class' );
function disable_kalium_acf_class( $classes ) {
  unset( $classes[ 'Kalium_ACF' ] );
  return $classes;
}

This code will prevent Kalium from loading its ACF compatibility class, which is not needed anyways, because you have ACF PRO.

Don't have WP ACF-VC Bridge yet?

Combine the powers of two giants

Get a must have plugin for modern WordPress website today!

0
Comments

Leave a Reply