57

How to Disable XML-RPC in WordPress

Powered by WPCodeBox

Learn how to disable XML-RPC in WordPress to enhance your website’s security and prevent potential attacks.


add_filter('xmlrpc_enabled','__return_false');

add_action('init',function() {
    if(strpos($_SERVER['REQUEST_URI'],'xmlrpc.php') !== false) {
        wp_redirect(home_url()); 
        exit;
    }
});
We also have a video in which we use this snippet:

Other Snippets

WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.