create_wp_page: Create a New WordPress Page

Description Usage Arguments Value Examples

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

Description

Creates a new page 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
create_wp_page(
  root_url,
  user,
  pass,
  title_val,
  excerpt_val = "",
  content_val,
  status_val,
  slug_val = NULL,
  author_val,
  format_val = "standard"
)

Arguments

root_url

The domain on which you wish to create the page.

user

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

pass

The password to be used in the API call to create the page. 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 pages.

content_val

The content of the page.

status_val

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

slug_val

The slug to be assigned to the page. Can be automatically generated if left as NULL.

author_val

The user ID of the author creating the page.

format_val

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

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
## Not run: 
create_wp_page(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!)',
status_val = 'draft',format_val = 'standard')

## End(Not run)

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