Prevent plugin update in Wordpress

Asked

Viewed 397 times

2

Hello.

I need to prevent an update plugin. I thought of simply cloning the plugin and change the following information:

/**
 * Plugin Name: AMP
 * Description: Add AMP support to your WordPress site.
 * Plugin URI: https://github.com/automattic/amp-wp
 * Author: WordPress.com VIP, XWP, Google, and contributors
 * Author URI: https://github.com/Automattic/amp-wp/graphs/contributors
 * Version: 0.7.2
 * Text Domain: amp
 * Domain Path: /languages/
 * License: GPLv2 or later
 *
 * @package AMP
 */

If I change this data, plugin continues receiving manufacturer update ?

I know there is plugins to solve this problem. But I don’t want to activate a plugin just to solve this particular problem.

Any hint ?

  • Ever thought about going in the settings ?

1 answer

3


I will leave here 3 options how to disable the plugin update.

Downloaded here version 0.7.0 of the AMP plugin to test.

https://downloads.wordpress.org/plugin/amp.0.7.0.zip

- Changing the plugin version

In the plugin main file (amp.php) change the plugin version (Version) to a higher one, in this case I put 100.7.0.

/**
 * Plugin Name: AMP
 * Description: Add AMP support to your WordPress site.
 * Plugin URI: https://github.com/automattic/amp-wp
 * Author: WordPress.com VIP, XWP, Google, and contributors
 * Author URI: https://github.com/Automattic/amp-wp/graphs/contributors
 * Version: 100.7.0
 * Text Domain: amp
 * Domain Path: /languages/
 * License: GPLv2 or later
 *
 * @package AMP
 */

- Removing the plugin from the update list

Add this code in the functions.php file of your theme

function remover_update_plugins($value) {
  if (isset($value->response['amp/amp.php'])) {
    unset( $value->response['amp/amp.php'] );
  }
   return $value;
}

add_filter( 'site_transient_update_plugins', 'remover_update_plugins' );

- Disabling the update of all plugins

Add this code to the wp-config.php file

define('DISALLOW_FILE_MODS', true);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.