atomicsolutions.dev
Menu

Getting Started

Installation

pnpm add @atomic-solutions/wordpress-utils

Create a client

import { createClient } from '@atomic-solutions/wordpress-utils'

const client = createClient({
  baseURL: 'https://your-site.com/wp-json',
})

Fetch posts

const { data: posts, total, totalPages } = await client.posts.list({ per_page: 10 })
// posts: WPPost[]

Authenticate

const client = createClient({
  baseURL: 'https://your-site.com/wp-json',
  auth: { username: 'user', password: 'pass' },
})

See the API Reference for all methods.