create_wp_post: Create a New WordPress Page

Description Usage Arguments Value Examples

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

Description

wCreates a new post on the WordPress site provided using the credentials entered, with content and other information provided.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
create_wp_post(
  root_url,
  user,
  pass,
  title_val,
  excerpt_val = "",
  content_val,
  fifu_val = NULL,
  status_val,
  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'.

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 tibble containing the arguments passed in as well as the URL retrieved from the API response.

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',format_val = 'standard',categories_val = 1, tag_val = 1)

## End(Not run)

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