Support

Account

Forum Replies Created

  • The following code checks if the ACF Pro or ACF plugins are not activated.

    /* 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 not activated  */
    if ( !is_plugin_active('advanced-custom-fields-pro/acf.php') )  {
     /* Do something when not active */
    }
    
    /* Checks to see if the acf plugin is not activated  */
    if ( !is_plugin_active('advanced-custom-fields/acf.php') )  {
      /* Do something when not active */
    }
  • 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.

  • 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.

  • Also might try changing:

    require_once('/acf-pro/acf.php');

    to:
    require_once( plugin_dir_path( dirname(__FILE__) ) . 'acf-pro/acf.php' );

  • If you haven’t already figured this out try using dirname(__FILE__) instead of only __FILE__ when using plugins_url()

    so instead of this:
    plugins_url( '/acf-pro/', __FILE__ )

    Try this:
    plugins_url( '/acf-pro/', dirname(__FILE__) )

  • 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 */
    }
  • I have the same error messages in my error log. Not sure what is causing the problem, everything still seems to work.

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