You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何禁用WordPress插件自动更新?解决WooCommerce排序插件崩溃问题

Fixing Auto-Update Issues for Modified WooCommerce Product Sort and Display LITE

Hey there, sorry to hear this auto-update headache is messing with your site—waking up to a broken site and having to restore backups is the worst. Let’s break down some targeted fixes since the general auto_update_plugin filter isn’t working for you:

1. Target the Specific Plugin with a Higher-Priority Filter

The global __return_false filter might be getting overridden by the plugin’s own code (some plugins force auto-updates internally). Instead, use a filter that targets only this plugin and runs with a higher priority to override any conflicting settings:

Add this to your child theme’s functions.php file (never edit the parent theme directly!):

add_filter( 'auto_update_plugin', 'disable_specific_sort_plugin_updates', 100, 2 );
function disable_specific_sort_plugin_updates( $update, $item ) {
    // Replace with your plugin's full slug (directory/main-file.php)
    $target_plugin = 'woocommerce-product-sort-display-lite/woocommerce-product-sort-display-lite.php';
    if ( $item->plugin === $target_plugin ) {
        return false; // Disable auto-updates for this plugin only
    }
    return $update; // Keep auto-updates enabled for other plugins
}

The 100 priority ensures your filter runs after most default filters, so it’ll override any auto-update triggers from the plugin itself.

2. "Fool" WordPress with a Fake High Version Number

If the filter still doesn’t work, edit the plugin’s main file to set an extremely high version number. WordPress will think your modified version is newer than the official release and skip updates:

  1. Navigate to /wp-content/plugins/woocommerce-product-sort-display-lite/
  2. Open the main plugin file (usually woocommerce-product-sort-display-lite.php)
  3. Find the comment block at the top and change the Version line to something like:
/*
Plugin Name: WooCommerce Product Sort and Display LITE
Version: 99.9.9
...
*/

This works because WordPress only updates when the official version is higher than your installed one. Just remember: if you ever need to manually update the plugin later, you’ll have to adjust this version number again.

3. Use a Must-Use (MU) Plugin for Unbeatable Priority

If the plugin is still forcing updates, move your filter to a must-use plugin—these load before all other plugins, so their filters can’t be overridden:

  1. Create a mu-plugins folder in /wp-content/ if it doesn’t exist
  2. Inside it, make a new file called disable-sort-plugin-updates.php
  3. Paste the same filter code from step 1 into this file (no need to add it to your theme anymore)
    MU plugins don’t show up in the WordPress plugin dashboard, so this filter will run silently and reliably.

4. Long-Term Fix: Stop Modifying the Plugin Directly

The best way to avoid this problem forever is to move your customizations out of the plugin file entirely. Most plugin changes can be replicated using hooks (actions/filters) in your child theme or a custom plugin:

For example, if you modified a function hooked to woocommerce_product_sort_display, you could do this in your child theme’s functions.php:

// Remove the plugin's original function
remove_action( 'woocommerce_product_sort_display', 'original_plugin_function_name', 10 );

// Add your modified version
add_action( 'woocommerce_product_sort_display', 'my_custom_sort_function', 10 );
function my_custom_sort_function() {
    // Your modified code here
}

This way, even when the plugin updates, your custom code stays intact—no more broken sites or backup restores.

First, double-check the plugin’s settings page too! Some plugins hide an auto-update toggle there that’s easier to use than code tweaks.

内容的提问来源于stack exchange,提问作者Ziil

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 06:55:45