-
Notifications
You must be signed in to change notification settings - Fork 0
/
wp_gdpr_compliance_stop_hack.php
43 lines (38 loc) · 1.46 KB
/
wp_gdpr_compliance_stop_hack.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
Plugin Name: WP GDPR Compliance stop hack
Plugin URI: https://github.com/ramonfincken/wp_gdpr_compliance_stop_hack
Description: Stops update_options calls from wp-gdpr-compliance version 1.4.2 and lower. Install as mu-plugin if you are managing MANY sites or if you are an ISP/webhost. Best is to upgrade to 1.4.3 immediately.
Author: Ramon Fincken
Version: 1.0.1
Author URI: https://www.managedwphosting.nl/
*/
/**
* Stops update_options calls from wp-gdpr-compliance version 1.4.2 and lower
*/
function wp_gdpr_compliance_stop_hack( $new_value, $old_value ) {
if ( ! function_exists( 'get_plugins' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = get_plugins();
// Walk
if( is_array( $plugins ) && count( $plugins ) > 0 ) {
// Suspect
if( isset( $plugins['wp-gdpr-compliance/wp-gdpr-compliance.php'] ) ) {
// Version 1.4.2 and lower
if ( ( version_compare( '1.4.2', $plugins['wp-gdpr-compliance/wp-gdpr-compliance.php']['Version'], '<=' ) ) ) {
$tracing = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 4 );
if( is_array( $tracing ) && count( $tracing ) == 4 ) {
// Hit, block request NOW
if( $tracing[3]['function'] == 'update_option' && substr_count( $tracing[3]['file'], 'wp-gdpr-compliance/Includes/Ajax.php' ) ) {
wp_die( 'die' );
}
}
}
}
}
return $new_value;
}
if( defined( 'DOING_AJAX' ) ) {
add_filter( 'pre_update_option', 'wp_gdpr_compliance_stop_hack', 10, 2 );
}