Support

Account

Home Forums ACF PRO Including ACF Pro in a Plugin

Solved

Including ACF Pro in a Plugin

  • If I include ACF Pro in a plugin and ACF is already installed on a client site, will the PRO features still work in my plugin?

    If I include ACF Pro in a plugin and the client has a licensed copy of ACF Pro installed, will my plugin disable their access to the ACF admin for their own stuff? If they have ACF (not pro) installed, can they still access ACF admin without the PRO features?

    Thanks!

  • What if I install two plugins and both plugins include ACF Pro? Will there be a conflict?

    If one version is newer than another, will the newer version be used?

  • You need to write the logic into your plugin to find out if the plugin is already activated.

    This should get you started:

    /* Checks to see if "is_plugin_active" function exists and if not load the php file that includes that function */
    if ( ! function_exists( 'is_plugin_active' ) ) {
    	include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); 
    }
    
    /* Checks to see if the acf pro plugin is activated  */
    if ( !is_plugin_active('advanced-custom-fields-pro/acf.php') )  {
     /* load the plugin and anything else you want to do */
    }
    
    /* Checks to see if the acf plugin is activated  */
    if ( !is_plugin_active('advanced-custom-fields/acf.php') )  {
     /* load the plugin and anything else you want to do */
    }
  • Thanks!

    If a site already has ACF installed and I include ACF:Pro in my plugin, will the end user have access to the Pro features? How do I handle that?

  • Haven’t tried this myself but you should be able to deactivate the activated plugin by using deactivate_plugins() wordpress function

    http://codex.wordpress.org/Function_Reference/deactivate_plugins

    Once the plugin is deactivated you could load the one in your plugin.

  • Side Note: if you want to use my previous code with the deactivate_plugins() function you should remove the “!” from the checks for the activated plugins in my previous code. Even though the comments in my previous code says it checks for if the plugin is activated, it actually checks if the plugin isn’t activated and then does whatever is inside the if statement. So removing the “!” will cause whatever is inside the if statement to run if the plugin is active.

  • Okay thanks. I was really wondering what the best practice was, but I guess I should just install ACF on my dev site and play with scenarios.

  • Hello Dave,

    I was wondering about the same thing.
    Can you post about the scenarios you tried and the results?

  • Just throwing in my 2 cents here, I was able to use just the conditional for acf pro and it works on wp installs with acf regular and pro.

    So, in my plugin file I have:

    /* Checks to see if “is_plugin_active” function exists and if not load the php file that includes that function */
    if ( ! function_exists( ‘is_plugin_active’ ) ) {
    include_once( ABSPATH . ‘wp-admin/includes/plugin.php’ );
    }
    /* Checks to see if the acf pro plugin is activated */
    if ( !is_plugin_active(‘advanced-custom-fields-pro/acf.php’) ) {
    /* load the plugin and anything else you want to do */
    }

    and if my install already has acf regular, my needed pro features work, and if it has acf pro, it doesn’t load and everything works as well.

Viewing 10 posts - 1 through 10 (of 10 total)

The topic ‘Including ACF Pro in a Plugin’ is closed to new replies.