Managing a WordPress website often involves juggling multiple plugins to achieve the desired functionality. However, running too many plugins can slow down your site. In some cases, you might want to selectively disable certain plugins on specific pages or posts to improve performance. This guide will show you how to selectively disable plugins in WordPress without using additional plugins. By doing so, you can enhance your site’s speed and user experience.
Why Selectively Disable Plugins?
- Improve Performance: Reduce page load times by disabling unnecessary plugins on specific pages.
- Increase Security: Minimise the risk of conflicts and security vulnerabilities.
- Enhance User Experience: Ensure a smoother and faster browsing experience for your visitors.
Step 1: Upload a child theme
To add the code snippets directly to your theme’s functions.php file you will need a child theme installed. If you do not have a child theme installed you can use our free child theme generator. Once you have created the child theme, you will need to upload it.
- Go to Themes > Add New.
- Click “Upload Theme”.
- Install and activate the child theme.
Step 2: Add Code to Disable Plugins
To selectively disable plugins, you’ll need to add custom code that checks the current page or post and disables plugins accordingly. Add the following code snippet:
/*
* Snippet: How to Selectively Disable Plugins in WordPress – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1330
* Tested with WooCommerce 10.7.0
* "Selectively disable plugins on specific pages"
*/
function wcsuccess_disable_plugins_on_specific_pages($plugins) {
// List of plugin filenames to disable
$plugins_to_disable = array(
'plugin-folder/plugin-file.php', // Replace with actual plugin folder and file name
'another-plugin-folder/another-plugin-file.php',
);
// Get the current page ID
$current_page_id = get_queried_object_id();
// Disable plugins on the homepage
if (is_front_page()) {
foreach ($plugins_to_disable as $plugin) {
if (in_array($plugin, $plugins)) {
unset($plugins[array_search($plugin, $plugins)]);
}
}
}
// Disable plugins on a specific page (e.g., page ID 123)
if ($current_page_id == 123) {
foreach ($plugins_to_disable as $plugin) {
if (in_array($plugin, $plugins)) {
unset($plugins[array_search($plugin, $plugins)]);
}
}
}
return $plugins;
}
add_filter('option_active_plugins', 'wcsuccess_disable_plugins_on_specific_pages');
Step 3: Identify Plugin Filenames
To correctly disable a plugin, you need to know its folder and filename. You can find this information in the plugin’s directory. For example, if the plugin is located at wp-content/plugins/plugin-folder/plugin-file.php, you would use plugin-folder/plugin-file.php in the code snippet.
Step 4: Customise for Different Conditions
You can customise the code to disable plugins under various conditions, such as on specific post types, categories, or templates. Here are a few examples:
- Disable Plugins on Posts:
/*
* Snippet: How to Selectively Disable Plugins in WordPress – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1330
* Tested with WooCommerce 10.7.0
* "Disable plugins on posts"
*/
if (is_single()) {
foreach ($plugins_to_disable as $plugin) {
if (in_array($plugin, $plugins)) {
unset($plugins[array_search($plugin, $plugins)]);
}
}
}
Disable Plugins on Category Pages:
/*
* Snippet: How to Selectively Disable Plugins in WordPress – 2026
* Author: John Cook
* URL: https://wcsuccessacademy.com/?p=1330
* Tested with WooCommerce 10.7.0
* "Disable plugins on category pages"
*/
if (is_category('your-category-slug')) {
foreach ($plugins_to_disable as $plugin) {
if (in_array($plugin, $plugins)) {
unset($plugins[array_search($plugin, $plugins)]);
}
}
}
Use Cases for Selectively Disabling Plugins
- Optimise Homepage Speed: Disable heavy plugins on the homepage to improve load times.
- Focus on Landing Pages: Disable unnecessary plugins on landing pages to ensure they load quickly and provide a seamless user experience.
- Simplify Checkout Process: Disable plugins during the checkout process to reduce potential conflicts and speed up transactions.
- Streamline Blog Posts: Disable social sharing or other non-essential plugins on blog posts for faster loading.
- Enhance Mobile Performance: Disable certain plugins when a user accesses the site from a mobile device to ensure optimal performance.
Conclusion
By selectively disabling plugins in WordPress, you can significantly enhance your site’s performance and user experience. The method described above allows you to control which plugins are active on specific pages, posts, or conditions without relying on additional plugins. Implementing this strategy can lead to faster page load times, reduced conflicts, and a more streamlined website.
I have been working with WordPress and WooCommerce since 2012 and have developed a deep knowledge of the content management system. Since 2012, I have developed several plugins and designed dozens of websites utilising different frameworks, CMS’s and programming languages. I am proficient in PHP, Python, Java, C, C++, R and JavaScript with limited experience in Go, Kotlin and Swift.
Educationally, I have a Master’s degree in cyber security a Bachelor’s (Hons, First Class) in Applied Research and a Graduate Certificate in Data Science. I’m currently undertaking PhD studies investigating IoT cybersecurity. I recently graduated with First Class Honours and Masters of Information Technology, receiving the Executive Dean’s Award for studies undertaken in the 2021 and 2022 academic years. I have worked in the information technology industry for the past 11 years primarily as a software/web developer specific to design, optimisation, network management and security. My research interests are in the areas of Internet of Things (IoT), 5G and Beyond Networks, information security for wireless networks and software development.
Stay In Touch

