update_wp_post: Update a WordPress Post

Description Usage Arguments Value Examples

View source: R/update-wp-post.R

Description

Updates an existing WordPress post with new values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
update_wp_post(
  root_url,
  user,
  pass,
  title_val,
  excerpt_val = "",
  content_val,
  fifu_val = NULL,
  status_val,
  post_id,
  author_val,
  format_val = "standard",
  categories_val,
  tag_val = ""
)

Arguments

root_url

The domain on which you wish to create the post.

user

The username to be passed into the API call to create the post.

pass

The password to be used in the API call to create the post. To get this value, you must have the Application Passwords plugin installed, and must create an application using that plugin via your WordPress admin panel; there you will get the password needed.

title_val

The title of the page you are creating.

excerpt_val

The excerpt to be shown where your WordPress features excerpts of post.

content_val

The content of the post.

fifu_val

If the Featured Image From URL plugin is installed, users can specify a remotely hosted image file to use as the featured image for the post. This field defaults to a value of NULL.

status_val

The status of the post. Can be one of 'draft','publish','pending','future', 'private'.

post_id

The ID of the post to be updated.

author_val

The user ID of the author creating the post.

format_val

The WordPress format to use. Defaults to 'standard'.

categories_val

The category IDs the post is to be associated with; comma separate in a character string if more than one.

tag_val

The tag IDs the post is to be associated with; comma separate in a category string if more than one.

Value

A list containing the status code of the API call. A status code of 200 indicates the call was a success.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
create_wp_post(root_url = 'https://domain.com',user = Sys.getenv('username'),
pass = Sys.getenv('password'),
title_val = 'post title',excerpt_val = 'post excerpt',
content_val = 'the post content as a string, with wordpress-accepted
<strong>html</strong> (or bbcode!)',
fifu_val = 'https://domain.com/image.png',
status_val = 'draft',post_id = 123,format_val = 'standard',categories_val = 1, tag_val = 1)

## End(Not run)

wordpressr documentation built on June 2, 2021, 1:06 a.m.