In some cases it may be useful to write a WordPress post in R Markdown and afterwards publish it to my blog. This can be done using the RWordPress package. First we setup a link to my blog:

if (!require('RWordPress'))
   install.packages('RWordPress', repos = 'http://www.omegahat.org/R', type = 'source')
library(RWordPress)
options(WordPressLogin = c(<your username> = '<your password>'),
        WordPressURL = 'http://www.research.relund.dk/wp/xmlrpc.php')

Next the post is written in a Rmd file and afterwards published to WordPress:

id<-knit2wp('RWordPress_post.Rmd', title = 'Publishing R markdown to WordPress', 
            categories = c('R'), publish=F )

Now the post with id is a draft on my blog and I can have a look at it before publishing it. If I want to update the post I do:

knit2wp('RWordPress_post.Rmd', title = 'Publishing R markdown to WordPress', postid=id, 
            action='editPost', categories = c('R'), publish = F )

To highlight the above code I use the WP Code Highlight.js plugin. If you use other syntax highlight plugins you may have to change the code a bit.