Support

Account

Home Forums General Issues Include ACF Pro in premium theme Reply To: Include ACF Pro in premium theme

  • I have a follow-up question on this, as I’m currently developing a premium plugin that will include ACF PRO. I need to include PRO because one of my admin screens relies on a Repeater field.

    I started from the code sample in the link you provided, which I’m running in the plugins_loaded action.

    The problem is, if the site has ACF (the free version) installed and active, that takes precedence, my embedded version of PRO doesn’t load, and my Repeater field doesn’t appear on the admin screen.

    The only way I’ve been able to find to prevent free ACF from loading is to create a plugin in wp-content/mu-plugins containing:

    add_filter('option_active_plugins', function($plugins) {
    	$key = array_search('advanced-custom-fields/acf.php',$plugins);
    	if ($key !== false) {
    		unset($plugins[$key]);
    	}
    	return $plugins;
    });

    That’s a really ugly solution. I either have to ask users to put this file into their mu-plugins folder (which probably doesn’t exist), or I need to have my plugin write it to their file system itself (eekā€¦ I don’t want to do that).

    Is there another way that I’m missing?