NB: Make sure you do a back up of your theme, files and database before attempting the tutorials

Intermediate
Web Hosting Canada

Last modified : May 20 2022

Estimated reading time : 0 minutes, 45 seconds - 80 words

In this tutorial, we will show you how to block the XML-RPC for WordPress website with a simple little function. The reason we want to do this is that it’s vulnerable to attacks; at this core, XML-RPC was created to ease communication between apps, clients, and WordPress.

These communications are with the API Rest. WP Scan strongly recommends that it needs to be disabled.

Fonction pour désactiver le XML-RPC sur WordPress

// disable xmlrpc
function themespress_remove_xmlrpc_methods( $methods ) {
  return array();
}
add_filter( 'xmlrpc_methods', 'themespress_remove_xmlrpc_methods' );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>