{"id":46641,"date":"2026-10-10T17:17:35","date_gmt":"2026-10-10T17:17:35","guid":{"rendered":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/?p=46641"},"modified":"2026-10-10T17:17:35","modified_gmt":"2026-10-10T17:17:35","slug":"disable-xml-rpc-wordpress-without-plugin","status":"publish","type":"post","link":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/disable-xml-rpc-wordpress-without-plugin\/","title":{"rendered":"Disable XML-RPC in WordPress Without a Plugin"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Disabling XML-RPC in WordPress is a common hardening step. <code>xmlrpc.php<\/code> is a favourite target for password guessing and for pingback abuse, where bots make your site send requests to other servers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The usual one-liner, <code>add_filter( 'xmlrpc_enabled', '__return_false' )<\/code>, does less than its name suggests. It only refuses methods that need a login; <code>pingback.ping<\/code>, <code>system.multicall<\/code> and the other public methods keep answering. This snippet turns all of them off and stops advertising the endpoint.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The snippet<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">&lt;?php\n\/\/ Refuse every XML-RPC method that needs a login.\nadd_filter( 'xmlrpc_enabled', '__return_false' );\n\n\/\/ Remove all remaining methods, including pingback.ping and system.multicall.\nadd_filter( 'xmlrpc_methods', 'dpc_disable_xmlrpc_methods', PHP_INT_MAX );\n\nfunction dpc_disable_xmlrpc_methods( $methods ) {\n\treturn array();\n}\n\n\/\/ Stop advertising the endpoint in the X-Pingback response header.\nadd_filter( 'wp_headers', 'dpc_remove_x_pingback_header' );\n\nfunction dpc_remove_x_pingback_header( $headers ) {\n\tunset( $headers&#91;'X-Pingback'&#93; );\n\n\treturn $headers;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Add it with Scripts Organizer<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><a href=\"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/dplugins.com\/downloads\/scripts-organizer\/\">Scripts Organizer<\/a> ships this snippet in its One-Click Import library. To add it by hand:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>In wp-admin go to <strong>Scripts Organizer \u2192 Code Blocks \u2192 Add New<\/strong> and give the block a title.<\/li>\n\n\n<li><strong>Script location<\/strong>: PHP.<\/li>\n\n\n<li><strong>Trigger location<\/strong>: Everywhere. <code>xmlrpc.php<\/code> loads WordPress and its plugins like any other request, so Everywhere code is in place before the XML-RPC server reads its method list. Admin only would never run there.<\/li>\n\n\n<li><strong>Action hook<\/strong>: leave it empty. The code only registers filters and actions, so it can run while plugins load.<\/li>\n\n\n<li>Paste the snippet into the PHP editor, enable the block and publish it.<\/li>\n\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">The same code also works unchanged in a small plugin or an mu-plugin file in <code>wp-content\/mu-plugins\/<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How it works<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>xmlrpc_enabled<\/code> returning <code>false<\/code> makes every authenticated method, such as publishing posts or <code>wp.getUsersBlogs<\/code>, return an error before the username and password are checked.<\/li>\n\n\n<li><code>xmlrpc_methods<\/code> runs when WordPress builds the XML-RPC server. Returning an empty array removes every method, so any call gets a &#8220;method not found&#8221; fault. The priority <code>PHP_INT_MAX<\/code> makes it run after plugins that add methods of their own.<\/li>\n\n\n<li><code>wp_headers<\/code> filters the HTTP headers WordPress sends with front-end pages. Removing <code>X-Pingback<\/code> stops telling scanners where the endpoint lives.<\/li>\n\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Customise it<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Jetpack and some remote publishing tools still use XML-RPC. To keep the endpoint for them and only close the parts bots abuse, drop the <code>xmlrpc_enabled<\/code> and <code>dpc_disable_xmlrpc_methods<\/code> lines and remove just these methods:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\">add_filter( 'xmlrpc_methods', 'dpc_remove_pingback_methods' );\n\nfunction dpc_remove_pingback_methods( $methods ) {\n\tunset( $methods&#91;'pingback.ping'&#93;, $methods&#91;'pingback.extensions.getPingbacks'&#93;, $methods&#91;'system.multicall'&#93; );\n\n\treturn $methods;\n}<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Gotchas<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>xmlrpc.php<\/code> still loads WordPress and answers, it just has nothing to offer. To stop those requests before PHP runs at all, block the file at the web server or CDN.<\/li>\n\n\n<li>Classic themes may print <code>&lt;link rel=\"pingback\"&gt;<\/code> themselves with <code>bloginfo( 'pingback_url' )<\/code> in header.php. Remove that line in a child theme if you want no trace left.<\/li>\n\n\n<li>Also untick <strong>Allow link notifications from other blogs (pingbacks and trackbacks) on new posts<\/strong> in <strong>Settings \u2192 Discussion<\/strong>.<\/li>\n\n\n<li>For more hardening, see <a href=\"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/lockdown-admin-backend-to-your-ip\/\">Lockdown Admin Backend to your IP<\/a> and <a href=\"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wordpress-security-updates-email-alert\/\">WordPress Security Updates Email Alert Without a Plugin<\/a>.<\/li>\n\n<\/ul>\n\n","protected":false},"excerpt":{"rendered":"<p>Disable XML-RPC in WordPress without a plugin: block login methods, pingbacks and system.multicall, and remove the X-Pingback header.<\/p>\n","protected":false},"author":1,"featured_media":46642,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"Disable XML-RPC in WordPress Without a Plugin","description":"Disable XML-RPC in WordPress without a plugin: block login methods, pingbacks and system.multicall, and remove the X-Pingback header."},"_slim_seo_primary_term_category":0,"_slim_seo_primary_term_post_tag":0,"footnotes":""},"categories":[130,3],"tags":[191,190,144,189],"dpc_library":[204],"class_list":["post-46641","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-wordpress","tag-hardening","tag-pingbacks","tag-security","tag-xml-rpc"],"_links":{"self":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts\/46641","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/comments?post=46641"}],"version-history":[{"count":1,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts\/46641\/revisions"}],"predecessor-version":[{"id":46660,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/posts\/46641\/revisions\/46660"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/media\/46642"}],"wp:attachment":[{"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/media?parent=46641"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/categories?post=46641"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/tags?post=46641"},{"taxonomy":"dpc_library","embeddable":true,"href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/code.dplugins.com\/wp-json\/wp\/v2\/dpc_library?post=46641"}],"curies":[{"name":"wp","href":"https:\/\/summer-heart-0930.chufeiyun1688.workers.dev:443\/https\/api.w.org\/{rel}","templated":true}]}}