Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro
Docs

Forms, Bindings, REST, GraphQL

REST

The values of a group can be read in the REST API of WordPress, in a field called ugly-fields. It is read only.

1 minute to read Updated 1 week ago

On this page

Turning it on

There are two switches, one over the other:

The REST API switch of a group, in Settings, Code and API
The REST API switch of a group, in Settings, Code and API.
Switch Where Default
REST API (the whole site) Settings → Advanced On
REST API (this group) The group's Settings → Code and API, in advanced mode Off

The values of a group come out only when both are on. If the switch of the whole site is off, the one of the group is shown off and cannot be changed, with a link to Settings.

What it looks like

The REST response of a page with the field ugly-fields, in a browser
The REST response of a page with the field ugly-fields, in a browser.
GET /wp-json/wp/v2/pages/12
JSON
{
	"id": 12,
	"title": { "rendered": "About us" },
	"ugly-fields": {
		"headline": "We make things",
		"team": [
			{ "name": "Ana", "role": "Chef" },
			{ "name": "Luis", "role": "Baker" }
		]
	}
}

It works for posts, pages, your own content types, terms and users: anything WordPress shows in its REST API.

Who sees what

A visitor only gets what they could read anyway:

  • A draft, a private post or a post with a password gives nothing.
  • A password field never leaves.
  • The fields of a user are private data: their own, or for those who may list users.
  • Fields that point at posts (post_object, relationship, page_link) show nothing of a post the visitor cannot read.

Did this article answer your question?