Purpose

This package aims to facilitate usage of the WordPress REST APIs native to all WordPress sites. To use this package with a given WordPress site, you’ll want:

  1. Pretty permalinks enabled (i.e. domain.com/category/post-title-id/ instead of domain.com/?p=123)
  2. The Application Passwords plugin installed and activated
  3. After installing and activating the Application Passwords plugin, select a user to whom you would like to grant permissions to update, create, or delete posts, pages, categories, or tags. This user is likely to be an administrator. Click on this user in the WordPress admin panel, and you will see the ability to create an application for them near the bottom of their user page. Create an application for them giving it name you desire. Upon doing so, you’ll be presented one time with a password that looks like this:

XXXX XXXX XXXX XXXX

Record this password, preferably as an environment variable. You can do this by entering a value in your .Renviron file, like so:

wordpress_key=XXXX XXXX XXX XXXX

Interactively, you can also set an environment variable like so:

Sys.setenv('wordpress_key'='XXXX XXXX XXX XXXX')

Naturally be sure to utilize the password provided to you by the Application Passwords plugin in your WordPress admin panel in place of the value noted above.

At this point, you are now ready to use wordpressr. The package, still in development, offers the ability to:

  1. Retrieve existing posts
  2. Update existing posts
  3. Create new posts
  4. Update existing pages
  5. Create new pages
  6. Retrieve existing wordpress authors
  7. Retrieve existing tags
  8. Create new tags
  9. Get existing categories
  10. Update existing categories