There are some plugins that are only used for specific pages on your blog. If you enable them globally, they will slow down the rest of your blog. WordPress doesn’t come with a built-in feature to conditionally enable plugins. I can’t even find a WordPress plugin that does this.
If you want to enable a WordPress plugin for just a single page, add this snippet to your
functions.php
:
add_action('plugins_loaded', function() {
if (/* condition */) {
wp_register_plugin_realpath(WP_PLUGIN_DIR . '/plugin_directory/plugin_file.php');
include_once(WP_PLUGIN_DIR . '/plugin_directory/plugin_file.php');
}
});
For example, I’m using
The SEO Framework as my SEO plugin. However, I really like
Yoast SEO‘s post analyzer. Therefore, I enabled Yoast just for my post edit pages by adding this snippet:
add_action('plugins_loaded', function() {
if (is_admin()) {
global $pagenow;
if ($pagenow === 'post.php' || $pagenow === 'post-new.php') {
wp_register_plugin_realpath(WP_PLUGIN_DIR . '/wordpress-seo/wp-seo.php');
include_once(WP_PLUGIN_DIR . '/wordpress-seo/wp-seo.php');
}
}
});