Freesoul Deactivate Plugins, for Developers

How to programmatically check if a plugin is globally active (only for versions >=

In your custom code, you can check if a plugin is globally active using the function fdp_is_plugin_globally_active( $plugin ).


$plugin = ‘woocommerce/woocommerce.php’;

if( function_exists( 'fdp_is_plugin_globally_active' ) && fdp_is_plugin_globally_active( $plugin ) ){
    //Your code here


$plugin is the path to the plugin main file relative to the plugins directory.

You can use this function to manage orphan shortcodes.

Imagine e.g. you disable the Revolution Slider plugin only on the mobile.

On the pages where you want the sliders only for desktop, on mobile you will see an orphan shortcode that looks like

[rev_slider slider_1]


You can prevent this kind of situation installing the plugin Specific Content For Mobile or adding this custom code:

if( function_exists( 'fdp_is_plugin_globally_active' ) && fdp_is_plugin_globally_active( $plugin ) ){
    add_shortcode( 'rev_slider','__return_false' );

Adding a custom ajax action to the FDP settings.

If you want to add the ajax actions of your plugin or theme, use the filter ‘eos_dp_integration_action_plugins’ as in the following example:


add_filter( 'eos_dp_integration_action_plugins','my_plugin_add_fdp_integration' );
//It adds custom ajax actions to the FDP Actions Settings Pages
function my_plugin_add_fdp_integration( $args ){
    $args['my-custom-actions'] = array(
        'is_active' => defined( 'MY_CUSTOM_PLUGIN_VERSION' ),
        'ajax_actions' => array(
            'my_action_example_name' => array( 'description' => __( 'Example of action description','my-textdomain' ) ),
            'my_action_other_example_name' => array( 'description' => __( 'Other example of action descriptionn','my-textdomain' ) ), )
    return $args;


It’s important that the value of the key ‘is_active’ returns true when your plugin or your theme is active. In the example above we used defined( ‘MY_CUSTOM_PLUGIN_VERSION’ ) because we suppose in the custom plugin, the constant MY_CUSTOM_PLUGIN_VERSION is defined.

You could use also function_exists or class_exists or whatever returns true when your plugin or theme is active.

In the example above ‘my_action_example_name’ is the name of the action you use to add your ajax function, read here for more details about how to add Ajax in plugins and themes.

In the case of the example you added your ajax function as in the following snippet:


add_action( 'wp_ajax_my_action_example_name','my_action_example_name' );

function my_action_example_name(){

    //Your code...




You will see your actions in the FDP settings as shown in the following picture.

If you are a plugin author, and you add the code described before in your plugin, then when the users have problems during ajax actions of your plugin that are caused by other plugins, you can suggest them deactivating all other plugins, but yours during the ajax activities.

How to load a specific plugin only for desktop devices.

Soon with the PRO version, you will be able to load specific plugins only for desktop devices.

Until this feature is ready if you are a developer you can easily follow these steps:

  • Create a mu-plugin in wp-content/mu-plugins. You can call it whatever you want, for instance, my-mu-plugin.php
  • Add this code:


defined( 'ABSPATH' ) || exit;
add_filter( 'fdp_frontend_plugins',function( $plugins ){
  if( !wp_is_mobile() && in_array( 'plugin-folder-name/plugin-main-file-name.php',$plugins ) ){
    unset( $plugins[array_search( 'plugin-folder-name/plugin-main-file-name.php',$plugins )] );
  return $plugins;
} );


Replace plugin-folder-name with the name of the folder of the plugin that you want to disable on the desktop and plugin-main-file-name.php with its main PHP file.