Skip to content

Instantly share code, notes, and snippets.

@koconder
Last active January 14, 2019 23:09
Show Gist options
  • Save koconder/9b6dd984ffd73522616f4eb9bb66fc46 to your computer and use it in GitHub Desktop.
Save koconder/9b6dd984ffd73522616f4eb9bb66fc46 to your computer and use it in GitHub Desktop.
Disable XML-RPC Pingbacks on Wordpress for Wp-Config
<?php
// Disable pingback.ping xmlrpc method to prevent Wordpress from participating in DDoS attacks
// More info at: https://docs.bitnami.com/?page=apps&name=wordpress&section=how-to-re-enable-the-xml-rpc-pingback-feature
// remove x-pingback HTTP header
add_filter('wp_headers', function($headers) {
unset($headers['X-Pingback']);
return $headers;
});
// disable pingbacks
add_filter( 'xmlrpc_methods', function( $methods ) {
unset( $methods['pingback.ping'] );
return $methods;
});
add_filter( 'auto_update_translation', '__return_false' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment