WordPress API SDK

QueryBuilder
in package

Table of Contents

Properties

$client  : Client
$endpoint  : string
$params  : array<string, mixed>

Methods

__construct()  : mixed
get()  : PaginatedResponse
Execute the query and return paginated response
getParams()  : array<string, mixed>
Get the query parameters
language()  : self
Filter by language (WPML support)
orderBy()  : self
Set order by field
page()  : self
Set page number
perPage()  : self
Set results per page
search()  : self
Search for a term
subtype()  : self
Filter by subtype (for search)
type()  : self
Filter by content type (for search)
where()  : self
Add a where clause

Properties

Methods

__construct()

public __construct(Client $client, string $endpoint) : mixed
Parameters
$client : Client
$endpoint : string

getParams()

Get the query parameters

public getParams() : array<string, mixed>
Return values
array<string, mixed>

language()

Filter by language (WPML support)

public language(string $languageCode) : self
Parameters
$languageCode : string
Return values
self

orderBy()

Set order by field

public orderBy(string $field[, string $direction = 'asc' ]) : self
Parameters
$field : string
$direction : string = 'asc'
Return values
self

page()

Set page number

public page(int $page) : self
Parameters
$page : int
Return values
self

perPage()

Set results per page

public perPage(int $perPage) : self
Parameters
$perPage : int
Return values
self

Search for a term

public search(string $term) : self
Parameters
$term : string
Return values
self

subtype()

Filter by subtype (for search)

public subtype(string $subtype) : self
Parameters
$subtype : string
Return values
self

type()

Filter by content type (for search)

public type(string $type) : self
Parameters
$type : string
Return values
self

where()

Add a where clause

public where(string $key, mixed $value) : self
Parameters
$key : string
$value : mixed
Return values
self
On this page

Search results