Check WordPress Plugin Dependencies

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.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

Check WordPress Plugin Dependencies

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

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 :

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.   How to uninstall cordova and ionic in ubuntu
  2.   Laravel Ajax Upload file image without submitting form
  3.   validation Update User Profile in Laravel 5.7
  4.   WordPress plugin dependencies on Activation
  5.   VueJS CRUD Operations with PHP and MySQLi Example
  6.   WordPress Plugin Activation Dependency Check
  7.   Laravel Clear Cache Commands Using PHP Artisan
  8.   how to check a plugin is activated or not in wordpress
  9.   vuejs Smooth Scroll to Top
  10.   jQuery AJAX Inline CRUD using Laravel MySQL