Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
Coppa WPB
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Come disabilitare l’XML-RPC in WordPress (metodo sicuro)

Nota editoriale: guadagniamo una commissione dai link dei partner su WPBeginner. Le commissioni non influenzano le opinioni o le valutazioni dei nostri redattori. Per saperne di più su Processo editoriale.

Volete disabilitare XML-RPC sul vostro sito WordPress?

XML-RPC è un’API di base di WordPress che consente agli utenti di connettersi al proprio sito web utilizzando applicazioni, strumenti e servizi di terze parti. Purtroppo, in passato gli hacker hanno trovato il modo di sfruttare XML-RPC per accedere ai siti web di WordPress.

In questo articolo vi mostreremo come disabilitare facilmente XML-RPC in WordPress.

Easily disable XML-RPC in WordPress

Cos’è l’XML-RPC in WordPress?

XML-RPC è un’API di base di WordPress, abilitata in modo predefinito dalla versione 3.5 di WordPress nel 2012. Consente agli sviluppatori di utilizzare i protocolli XML e HTTPS per connettersi e interagire con il sito web di WordPress.

In breve, è necessario che XML-RPC sia abilitato per accedere al blog e pubblicarlo in remoto, ad esempio quando si desidera utilizzare un’applicazione mobile per gestire il sito o effettuare connessioni a servizi di automazione come Uncanny Automator o Zapier.

Tuttavia, se non utilizzate applicazioni mobili con il vostro sito web, alcuni esperti di sicurezza di WordPress potrebbero consigliarvi di disabilitare XML-RPC. In questo modo si chiude una porta che potrebbe essere sfruttata per violare il vostro sito web.

Detto questo, vediamo come disabilitare facilmente l’API XML-RPC in WordPress. Il metodo .htaccess è il migliore perché è quello che richiede meno risorse, mentre gli altri metodi sono più semplici per i principianti.

Metodo 1: disabilitare l’XML-RPC di WordPress con .htaccess (avanzato)

Questo metodo è riservato agli utenti esperti, poiché è necessario modificare il file .htaccess del sito. Si consiglia ai principianti di utilizzare i metodi 2 o 3.

Questo metodo presenta diversi vantaggi, come la possibilità di consentire l’accesso remoto a voi stessi e al vostro team, limitando tutti gli altri. Inoltre, non influisce negativamente sulle prestazioni di WordPress, poiché disabilita le richieste XML-RPC prima che vengano trasmesse a WordPress.

È necessario aggiungere il seguente codice al file .htaccess. Potete farlo collegandovi al vostro sito con un client FTP o un gestore di file. Inoltre, gli utenti di All in One SEO possono utilizzare l’editor del codice integrato nel plugin per aggiungere lo snippet di codice, come si può vedere nello screenshot qui sotto.

# Block WordPress xmlrpc.php requests
<Files xmlrpc.php>
order deny,allow
 deny from all
allow from 123.123.123.123
</Files>
Use AIOSEO Pro to disable XML-RPC from htaccess

Se si desidera dare a un determinato utente l’accesso remoto al sito, è sufficiente sostituire “123.123.123.123” sulla riga 5 con il suo indirizzo IP. È possibile aggiungere più indirizzi IP separandoli con degli spazi.

Oppure, se si vuole disabilitare completamente XML-RPC, si elimini del tutto la riga 5.

Nota: se non riuscite a trovare .htaccess, consultate la nostra guida sul perché non si trova .htaccess in WordPress.

Metodo 2: disabilitare WordPress XML-RPC con uno snippet di codice (consigliato)

Questo metodo richiede l’aggiunta di codice al vostro sito web WordPress. Se non l’avete mai fatto prima, date un’occhiata alla nostra guida su come copiare e incollare snippet di codice personalizzati in WordPress.

WPCode è il modo più semplice e sicuro per aggiungere codice al vostro sito WordPress. Vi aiuta a gestire gli snippet di codice e impedisce che eventuali errori possano danneggiare il vostro sito.

In questo metodo, utilizzeremo uno degli snippet di codice integrati in WPCode per disabilitare XML-RPC.

Per prima cosa, è necessario installare il plugin gratuito WPCode. Per istruzioni passo-passo, selezionate la nostra guida passo-passo su come installare un plugin di WordPress.

Dopo l’attivazione, andare su Code Snippets ” Add Snippet. La libreria WPCode contiene già uno snippet che disabilita XML-RPC. Lo si può trovare cercando “xml”.

Una volta individuato, è necessario fare clic sul pulsante “Usa snippet”.

Use WPCode Library to disable XML-RPC

Successivamente, è necessario portare l’interruttore “Attiva” in posizione “On”.

Infine, fare clic sul pulsante “Aggiorna” per abilitare lo snippet sul sito e disabilitare l’API XML-RPC.

Turn the WPCode snippet on by clicking Activate and pressing Update

Metodo 3: disabilitare WordPress XML-RPC con un plugin

Si tratta di un metodo semplice che può essere utilizzato se non si vogliono aggiungere altri personalizzazioni al sito web con un plugin di snippet di codice.

È sufficiente installare e attivare il plugin Disable XML-RPC-API. Per maggiori dettagli, consultate la nostra guida passo-passo su come installare un plugin per WordPress.

Il plugin funziona subito e disattiva immediatamente XML-RPC.

È possibile navigare in Sicurezza XML-RPC ” Impostazioni XML-RPC per configurare il plugin. Ad esempio, è possibile consentire a determinati utenti di accedere a XML-RPC aggiungendo in whitelist i loro indirizzi IP.

The Disable XML-RPC-API Plugin Settings

Verifica che WordPress XML-RPC sia disabilitato

Ora dovreste selezionare se avete disabilitato l’API XML-RPC sul vostro sito web WordPress.

Si può anche verificare che XML-RPC sia disabilitato semplicemente visitando l’URL http://example.com/xmlrpc.php nel browser. Assicurarsi di sostituire “example.com” con il dominio del proprio sito web.

Se XML-RPC è disabilitato, dovrebbe essere visualizzato il messaggio di errore: ‘Vietato: non hai i permessi per accedere a questa risorsa’.

Speriamo che questo articolo vi abbia aiutato a capire come disabilitare facilmente XML-RPC in WordPress. Potreste anche voler apprendere come installare Google analytics in WordPress o consultare il nostro elenco di software di live chat per le piccole imprese.

Se questo articolo vi è piaciuto, iscrivetevi al nostro canale YouTube per le esercitazioni video su WordPress. Potete trovarci anche su Twitter e Facebook.

Divulgazione: I nostri contenuti sono sostenuti dai lettori. Ciò significa che se cliccate su alcuni dei nostri link, potremmo guadagnare una commissione. Vedi come WPBeginner è finanziato , perché è importante e come puoi sostenerci. Ecco il nostro processo editoriale .

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Il kit di strumenti WordPress definitivo

Ottenete l'accesso gratuito al nostro kit di strumenti - una raccolta di prodotti e risorse relative a WordPress che ogni professionista dovrebbe avere!

Reader Interactions

47 commentiLascia una risposta

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Jiří Vaněk says

    Thank you for the snippet. In the end, I disabled XML-RPC using WPCode because it seemed like the easiest way, and I can also easily revert XML-RPC back. Great!

  3. Pete Mason says

    in htaccess, the line:
    allow from 123.123.123.123
    Looks like it wants to be edited with my IP address. But this is not stated anywhere —?

    • WPBeginner Support says

      Blocking would attempt to limit access to the feature while disabling would turn it off completely. If you disable it you wouldn’t need to worry about someone accessing it through a different method.

      Admin

  4. Rashmi K says

    The recomnended plugin Disable XML-RPC has not been updated since last 2 years. It says the plugin has not been tested with the last 3 releases of wordpress.

  5. Nikhil says

    Hi,

    Will disabling the xmlrpc.php access also disable the access to wordpress apis used for android/ios app development?

  6. Vyom says

    Found the solution:
    Adding following information in nginx config:
    # nginx block xmlrpc.php requests
    location /xmlrpc.php {
    deny all;
    }

  7. Vyom says

    I use nginx instead of Apache. Can I still use .htaccess on my site?
    And do I need to store this file in public_html directory, or one level above it?

    • WPBeginner Support says

      Yes, the .htaccess in your site’s root folder is where you would add the .htaccess code :)

      Admin

  8. malcolm says

    why would we allow 123.123.123.123 ?

    If we aren’t using the service at all, why not let “deny all” be absolute?

    • Edward says

      If i’m reading the code correctly;
      order deny,allow – puts deny before allow, since deny is ‘all’ then allow isn’t processed
      deny from all – does what it says
      allow from 123.123.123.123 – is a place holder

      I gather that if you have a fixed IP address you could change order to “allow,deny” and replace 123.123.123.123 with your IP address. That would allow your IP then deny all others.

  9. David Hoy says

    Thanks WP-Beginner, I’m trying to be baddest WP boy in my neighbourhood and this is exactly why I keep coming back to you guys, each question I have you say; here is the easy way, and here is the RIGHT way :-)

    Me an my .htaccess are going to have a little chat about htpasswrd and this here XMLRPC thingy my clients will never need.

    You all just made my corner of the net a little bit safer, as MailChimp would say: High Fives!

  10. Cezar says

    Ok, i will use this code but i want IFTTT to have work on my website what i need to add?

    # Block WordPress xmlrpc.php requests

    order deny,allow
    deny from all
    allow from 123.123.123.123

  11. PhilB says

    Hi,

    I have followed the instructions to block the xmlrpc.php file using .htaccess but im not sure if it is working.

    Im using wordfence security and in the live traffic view i can see the requests for the xmlrpc.php file have stopped, but if i check my access logs

    tail -f /apache2/logs/access_log

    I can still see the requests coming in, but the code at the end has changed from 500 to 403. Im concerned im getting a false report from my WordFence plugin and that im still being flooded with spam. Can anyone advise?

    Thanks,

    PhilB

    • David Hoy says

      Oh yeah! Thats working perfectly, your XMLRPC is FORBIDDEN!

      HTTP Status Code 403: The server understood the request but refuses to authorize it.

  12. Raymundo says

    I got a weird problem…

    I’m using my wordpress blogs with IFTTT and all worked fine, until I integrated it with MaxCDN; IFTTT immediately stopped working. I did some research and the problem might be related to XML-RPC that was de-activated.

    When I check my dashbord in “Settings” > “Writing” , I don’t see anything like XML-RPC, Remote Publishing, etc. I’ve checked database in options, also xml-rpc not available / missing.

    I need to activate XML-RPC to keep my IFTTT working.

    How do I re-activate XML-RPC; all I need is a script that I can add in .htaccess or functions.php to activate XML-RPC.

    And why am I missing the XML-RPC funtionality in my dashboard.

    Thank You!

  13. Muhammad Ammar Ashfaq says

    I was searching for how to add this file xmlprc.php to my wordpress i am using 4.5.3 version and i came to this page. I need to add this php file because when i enable jetpack i got error of site_inaccessible. Please tell me hot to resolve this error my site is

    • WPBeginner Support says

      Connect to your WordPress site using FTP client or File Manager in cPanel. In your website’s root directory look for xmlrpc.php file. If it is there, then try step 2. If it isn’t then download a fresh copy of WordPress. Unzip and extract it and upload xmlrpc.php file back to your site’s root directory.

      Step 2: Check your WordPress theme’s functions file for the code that disables XML-RPC.

      Step 3: Check your .htaccess and wp-config files.

      Admin

  14. omonaija says

    Please,what can i do to enable xmlrpc on my site?because i can’t login using wordpess mobile app on my smartphone..

  15. Mook says

    Booyah! This WP filter fixed the script kiddie attack. I still firewalled the person, but I don’t have to watch the logs like a hawk to add more IPs to the firewall. THANK YOU.

  16. Chad says

    I’m totally onboard for disabling xmlrpc.php server wide in my /etc/httpd/conf/includes/pre_main_global.conf file. But I am left with this questions…is there a way to determine that a particular plugin “NEEDS” xmlrpc.php in order to work? I have concerns with blocking access to it and then having an issue 2 months down the road and not know that the issue is with the fact that I blocked xmlrpc.php previously.

    Are there any common signs to look for in a log file or such which would point to a xmlrpc.php block as the cause?

  17. Phranq says

    Hey am using WordPress app to post with my android smartphone. Now I can’t login and my login credentials are correct. The response I got was ” we can’t log you in couldn’t connect to the WordPress site”.Could you help me fix this WordPress app login error.

    • WPBeginner Support says

      If you had disabled XML RPC then you may not be able to login using WordPress mobile app. Look in your theme’s functions.php file for this code

      add_filter('xmlrpc_enabled', '__return_false');

      If it is there, then you need to remove it. You can also try deactivating plugins and turning them on one by one until you find the plugin that is stopping you from login using WordPress mobile app.

      Admin

  18. Josiah says

    It’s worth noting, that “allow from 123.123.123.123” is optional, and if used should be updated to include your IP, or the IP of the device that needs access to xmlrpc.php (it would be good to cite examples in this article).

  19. Natalie says

    I am using GoodbyeCaptcha plugin to turn off the XML-RPC and works with no problem while Jetpack is activated.
    Hope it helps

  20. ATI says

    Sorry, I’ve tried this method many times. It didn’t work for me – in fact it brought the front end down (blocking visitors read access to the web page) after adding these codes to the .htaccess file.

  21. Christopher Ross says

    Keith, there’s a trend in WordPress to move non-theme related functions out of the functions.php file and into a “site specific plugin”, basically a plugin that you only activate on one unique website and it stores the non-theme related functions for that site.

    You can accomplish the same thing by placing the code in your functions.php file.

  22. Keith Davis says

    Hi Guys
    Sorry to be a bit thick but could you expand on… “All you have to do is paste the following code in a site-specific plugin:”

    Which plugins are site specific?

Lascia una risposta

Grazie per aver scelto di lasciare un commento. Tenga presente che tutti i commenti sono moderati in base alle nostre politica dei commenti e il suo indirizzo e-mail NON sarà pubblicato. Si prega di NON utilizzare parole chiave nel campo del nome. Avremo una conversazione personale e significativa.