Prevent plugin update in Wordpress

2

Hello.

I need to prevent updating of a plugin . I thought of simply cloning the plugin and changing 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 does plugin keep getting the manufacturer update?

I know there is plugins to solve this problem. But I do not want to enable a plugin just to solve this specific problem.

Any tips?

    
asked by anonymous 22.09.2018 / 02:10

1 answer

3

I'll leave here 3 options on how to disable the plugin update.

Download the AMP plugin version 0.7.0 here for testing.

link

- Changing the plugin version

In the main file of the plugin (amp.php) change the version of the plugin (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 update list plugin

Add this code to 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 updating of all plugins

Add this code to the wp-config.php file

define('DISALLOW_FILE_MODS', true);
    
22.09.2018 / 04:21