Is it smart to require_once wp-admin/includes/plugin.php when you need only one function from it
This question is loosely related to Why some plugins are including wp-includes/plugin.php file?
What I’m trying to figure out is, when is it smart to include this file, and when isn’t it?
I’m building a plugin that’d need the is_plugin_active()
function in the frontend (where it doesn’t exist, because it’s only loaded in wp-admin
.
My gut says it’s a waste (of memory or performance, maybe?) to include the entire wp-admin/includes/plugin.php
just for the purpose of loading one function. So, IMO, a better idea would be to copy the is_plugin_active()
function to my own plugin and run it from there.
Am I right about this? Or would you say: No, just require_once()
the plugin.php
file — even if you only need one function from there? And if so, why?
Leave an answer