'How do you protect certain php files from overwriting by updates in Wordpress?

Let's say I have made some changes on a php file from a certain plug-in. How do I prevent their lost when someone else decide to update this plug-in?



Solution 1:[1]

You should try to alter the plugin's behavior with a plugin of your own. But that depends on the nature of the changes you've done.

You can disable its update capabilities with the following filter:

add_filter( 'site_transient_update_plugins', 'filter_plugin_updates' );
function filter_plugin_updates( $value ) {
    unset( $value->response['akismet/akismet.php'] );
    return $value;
}

There are a couple of other methods to deal with this in the Answer from where I copied this code:

If I rename a plugin (in its main php file) do I still get update notifications?

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Community