Skip to content

struct

WordPress

pub struct WordPress {
    /* private fields */
}

A WordPress site, read through its REST API (/wp-json/wp/v2).

Methods

new

pub fn new(site: &str) -> WordPress

A self-hosted site's root URL.

com

pub fn com(site: &str) -> WordPress

A WordPress.com site (example.wordpress.com or a mapped domain).

pub fn plain_permalinks(self) -> WordPress

Use ?rest_route=/wp/v2/… (sites with "Plain" permalinks).

authorization

pub fn authorization(self, header: &str) -> WordPress

Send credentials, e.g. an application password as Basic auth ("Basic base64(user:app-password)") — server-side only.

posts

pub fn posts(&self, q: &Posts) -> Request

The posts q asks for.

post

pub fn post(&self, id: u64) -> Request

The post with id, with its embedded author, image and terms.

pages

pub fn pages(&self, q: &Posts) -> Request

The pages q asks for.

page

pub fn page(&self, id: u64) -> Request

The page with id, with its embedded author, image and terms.

categories

pub fn categories(&self) -> Request

Every category.

tags

pub fn tags(&self) -> Request

Every tag.

media

pub fn media(&self, id: u64) -> Request

The media item (image or file) with id.

Trait implementations