duncantl / RWordPress

http://www.omegahat.org/RWordPress
26 stars 23 forks source link

faultCode: 405 faultString: XML-RPC services are disabled on this site. #7

Open tjfarrar opened 4 years ago

tjfarrar commented 4 years ago

I am trying to upload an .Rmd file as a Wordpress blog post using the following code:

options(WordpressLogin = c(`me@emaildomain.com` = 'password'),
        WordpressURL = 'https://www.sitedomain.com/xmlrpc.php')
knitr::knit2wp('blogpost005.Rmd', title = 'Foo', publish = FALSE)

This fails with the above-mentioned 405 error. However, the site administrator assures me that XML-RPC services are enabled on the site. Under WP htAccess Editor I found the following, which I believe is the standard configuration for enabling XML-RPC:

<Files "xmlrpc.php">
Order Allow,Deny
allow from all
</Files>

I also verified that the xmlrpc.php page on the site domain does load in the browser and gives the message, 'XML-RPC server accepts POST requests only.' I am not sure whether that is typical, or whether the knit2wp function does actually make a POST request (if not, that could be the source of the problem).

Comparing my R code to the demo in the knitr documentation, there are only two differences. One is that in my case the WordpressURL is a private domain rather than a sub-domain of wordpress.com; I don't think that should matter. The second difference is that my username on the site is my email address. Therefore I could not exactly specify WordpressLogin in the form WordpressLogin = c(user = 'password'), because R would not accept user being replaced by an email address due to the '@' symbol being disallowed in variable names. I thought I could get around this by placing my email address within backticks. The options command then executes, but I'm not sure whether that or something else is causing the 405 error.