GraphQL Syntax
Builderius uses a custom GraphQL implementation optimized specifically for WordPress Pro Feature data structures and page builder workflows. Unlike standard GraphQL, this syntax is designed to work seamlessly with WordPress's post types, custom fields, taxonomies, and user roles while being accessible to visual builders rather than requiring deep GraphQL knowledge.
Understanding these syntax rules is essential for writing valid queries that leverage WordPress data efficiently.
Root Object Requirement
All queries must be wrapped in a root object:
{
# ... all code here
}
Basic Syntax Rules
- Query Structure
- Field Selection
- Nested Objects
Every query follows this structure:
{
query_name {
field_name
}
}
Fields are listed inside curly braces:
{
post {
post_title
post_content
}
}
Use nested braces for object properties:
{
post {
featured_image {
file_url
alt_text
}
}
}
Arguments Syntax
- Simple Arguments
- Arguments Object
Arguments use parentheses and key-value pairs:
{
query_function(argument: "value") {
field
}
}
Collection queries use an arguments object that contains a series of key-value pairs:
{
posts_query(
arguments: {
key: "value"
another_key: 123
}
) {
posts {
field
}
}
}
Data Types
- Strings
- Numbers
- Booleans
- Arrays
Use double quotes for string values:
{
posts_query(
arguments: {
post_type: "post"
post_status: "publish"
}
) {
posts {
post_title
}
}
}
Numbers don't require quotes:
{
posts_query(
arguments: {
posts_per_page: 10
author: 5
}
) {
posts {
post_title
}
}
}
Use true or false without quotes:
{
terms_query(
arguments: {
hide_empty: true
taxonomy: "category"
}
) {
terms {
name
}
}
}
Use square brackets for arrays:
{
posts_query(
arguments: {
post__in: [1, 2, 3, 4]
post_status: ["publish", "private"]
}
) {
posts {
post_title
}
}
}