Reputation: 1
Lets take the fallowing example: In my website i have two plugins: plugin1 and plugin2. Both these plugins happen to use "Data Tables" so that means that the server hosting the Wordpress Website ends up with two copies of "DataTables" because each plugin has its own paths to enqueue the scripts and styles.
If i am the person developing both plugins how can I avoid copying "DataTables" twice on the server and make plugin1 and plugin2 independent from each other.
Upvotes: 0
Views: 15
Reputation: 2996
Conditionally include your code by placing inside a function_exists
check:
if (!function_exists('DataTables')) {
// will only run if DataTables is not defined already
}
Upvotes: 0