| 1 |
<?php |
| 2 |
|
| 3 |
/* |
| 4 |
Plugin Name: Stop XML-RPC Attacks |
| 5 |
Description: Secure your site's XML-RPC by removing some methods, while you can still use XML-RPC. |
| 6 |
Author: Pascal CESCATO |
| 7 |
Version: 1.0.1 |
| 8 |
Author URI: https://tsw.ovh |
| 9 |
License: GPLv3 |
| 10 |
*/ |
| 11 |
|
| 12 |
/* |
| 13 |
This program is free software: you can redistribute it and/or modify |
| 14 |
it under the terms of the GNU General Public License version 2 as published by |
| 15 |
the Free Software Foundation. |
| 16 |
|
| 17 |
This program is distributed in the hope that it will be useful, |
| 18 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 |
GNU General Public License for more details. |
| 21 |
|
| 22 |
You should have received a copy of the GNU General Public License |
| 23 |
along with this program. If not, see <https://www.gnu.org/licenses/gpl.html>. |
| 24 |
*/ |
| 25 |
|
| 26 |
add_filter('xmlrpc_methods', function ($methods) { |
| 27 |
unset($methods['system.multicall']); |
| 28 |
unset($methods['system.listMethods']); |
| 29 |
unset($methods['system.getCapabilities']); |
| 30 |
unset($methods['pingback.extensions.getPingbacks']); |
| 31 |
unset($methods['pingback.ping']); |
| 32 |
return $methods; |
| 33 |
}); |
| 34 |
|
| 35 |
add_action('wp', function () { |
| 36 |
header_remove('X-Pingback'); |
| 37 |
}, 9999); |