Check WordPress Plugin Dependencies

Today, We want to share with you Check WordPress Plugin Dependencies.In this post we will show you wordpress plugin require another plugin, hear for how to check a plugin is activated or not in wordpress we will give you demo and example for implement.In this post, we will learn about How to check if certain plugin exists and in expected version with an example.

Check WordPress Plugin Dependencies

There are the Following The simple About Check WordPress Plugin Dependencies Full Information With Example and source code.

Read Also:  Date Range Search Jquery DatePicker using Ajax PHP with MySQL

As I will cover this Post with live Working example to develop wordpress check if plugin is used, so the How to check WordPress plugin dependencies for this example is following below.

WordPress check if plugin is active

Check in Admin Area

if (is_plugin_active('woocommerce/woocommerce.php')) { 
	// plugin is active
}

Check on front-end

include_once(ABSPATH .'wp-admin/includes/plugin.php');

if (is_plugin_active('woocommerce/woocommerce.php')) { 
	// plugin is active
}

Checking for a Plugin Dependency on Activation

function to run on activation

function your_custom_plugin_addon_activate() {
  
    if( !class_exists( 'WooCommerce' ) ) {
        deactivate_plugins( plugin_basename( __FILE__ ) );
        wp_die( __( 'Please install and Activate WooCommerce.', 'http://wordpress.org/extend/plugins/woocommerce/' ), 'Plugin dependency check', array( 'back_link' => true ) );
    }
}

sets up activation hook

register_activation_hook(__FILE__, 'your_custom_plugin_addon_activate');

Check if WooCommerce is active

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
    // Put your plugin code here
}

Web Programming Tutorials Example with Demo

Read :

Read Also:  Laravel 5.7 Jquery Ajax CRUD(insert update delete)

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about Check Word Press Plugin Dependencies.
I would like to have feedback on my infinityknow.com blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.


Related FAQ

Here are some more FAQ related to this Article:

  1. Read Also:  PHP Remove specific value from array
  2. Read Also:  PHP remove http https www and slashes from URL
  3. Read Also:  AngularJs http post Request To PHP json
  4. Read Also:  WordPress Plugin Activation Dependency Check
  5. Read Also:  PHP Laravel 6 Custom Error Page Example
  6. Read Also:  how to check a plugin is activated or not in wordpress
  7. Read Also:  Laravel 5.6 Sending Emails using SMTP Tutorial
  8. Read Also:  How To Convert XML To Associative Array in PHP
  9. Read Also:  Abstract Class in C# Tutorial with Example
  10. Read Also:  Dynamic and Dependent Dropdown list using AngularJS with PHP
CLOSEX