Support Log in
Field Forge Integrations

Field Forge + WPGraphQL — Headless WordPress

Field Forge ships with native WPGraphQL integration. When both plugins are active, Field Forge Pro registers its GraphQL types for its field groups, with no separate add-on plugin, no manual schema registration. Your custom fields are immediately queryable via GraphQL.


What WPGraphQL is

According to its WordPress.org listing (October 2026), WPGraphQL is a free, open-source WordPress plugin that provides an extendable GraphQL schema and API for any WordPress site. A JavaScript frontend can query that schema.

Custom fields of other plugins are not part of that schema until a plugin adds them. With Field Forge Pro, when Field Forge and WPGraphQL are both active, the Field Forge custom fields appear in the GraphQL schema.


How the registration works

On plugin activation

When Field Forge is activated (or WPGraphQL is activated after Field Forge), Field Forge:

  1. Detects WPGraphQL via function_exists('register_graphql_object_type')
  2. Reads all field groups from the database
  3. Generates GraphQL types for each field group — with nested types for repeaters, groups, and flexible content
  4. Registers types with WPGraphQL via the official WPGraphQL type registration API
  5. Adds a fieldforge field to every queryable post type
  6. Registers resolvers that fetch field values from Field Forge’s custom table storage

Pro registers them when WPGraphQL builds its schema.

On field group changes

When you add, edit, or delete a field group in Field Forge’s visual builder, the GraphQL schema reflects the change. WPGraphQL’s schema cache is flushed and Field Forge re-registers the updated types on the next request.

You don’t need to manually regenerate anything.


Example GraphQL query

With Field Forge and WPGraphQL both active, you can query custom fields like this:

query GetHomepage {
  page(id: "home", idType: URI) {
    title
    fieldforge {
      heroSection {
        title
        subtitle
        backgroundImage {
          sourceUrl
          altText
          mediaDetails {
            width
            height
          }
        }
        ctaButton {
          text
          url
          openInNewTab
        }
      }
      featuresSection {
        sectionTitle
        features {
          icon
          title
          description
        }
      }
    }
  }
}

The fieldforge key exposes all field groups assigned to the page via location rules. Each field group is a typed object with its own fields.


Nested types

Repeater fields, groups, and flexible content all produce proper nested GraphQL types:

Repeater → array type

type TeamPageFieldforge {
  teamMembers: [TeamMemberRow]
}

type TeamMemberRow {
  name: String
  photo: MediaItem
  bio: String
  socialLinks: [SocialLinkRow]  # Nested repeater
}

Flexible content → union type

type LandingPageFieldforge {
  pageSections: [PageSectionLayout]
}

union PageSectionLayout = HeroLayout | FeaturesLayout | CTALayout

Query union types with inline fragments:

query GetLandingPage {
  page(id: "landing", idType: URI) {
    fieldforge {
      pageSections {
        __typename
        ... on HeroLayout {
          title
          backgroundImage { sourceUrl }
        }
        ... on FeaturesLayout {
          sectionTitle
          features {
            title
            description
          }
        }
      }
    }
  }
}

Relational fields

Relational fields (Post Object, Relationship, User, Taxonomy) resolve to WPGraphQL’s native types:

type ProductFieldforge {
  relatedProducts: [Post]      # WPGraphQL's Post type
  author: User                 # WPGraphQL's User type
  categories: [Category]       # WPGraphQL's Category type
}

This means you can chain queries through relationships:

query GetProduct {
  post(id: "product-a", idType: URI) {
    fieldforge {
      productDetails {
        relatedProducts {
          title
          slug
          featuredImage {
            node {
              sourceUrl
            }
          }
          fieldforge {
            productDetails {
              price
            }
          }
        }
      }
    }
  }
}

Options pages in GraphQL

Options page field values are exposed as root-level GraphQL types:

type FieldforgeOptions {
  siteSettings: SiteSettingsFields
  headerSettings: HeaderSettingsFields
  footerSettings: FooterSettingsFields
}

type Query {
  fieldforgeOptions: FieldforgeOptions
}

Query them without a specific post context:

query GetGlobalSettings {
  fieldforgeOptions {
    siteSettings {
      companyName
      phone
      email
    }
    footerSettings {
      copyright
      socialLinks {
        platform
        url
      }
    }
  }
}

Combining with TypeScript generation

Field Forge also generates TypeScript definitions for the same field groups. Use both:

  1. GraphQL for runtime data fetching
  2. TypeScript for compile-time type safety in your frontend code

The two feed different pipelines but represent the same underlying field group data. Update a field group in Field Forge and both the GraphQL schema and TypeScript definitions update together.

For teams using GraphQL Code Generator, you can introspect the Field Forge-augmented WPGraphQL schema and generate typed query hooks:

# codegen.yml
schema: https://wp.example.com/graphql
documents: './src/**/*.graphql'
generates:
  ./src/gql/:
    preset: client
    plugins: []

Run graphql-codegen and your frontend has fully-typed GraphQL queries for all Field Forge fields.


WPGraphQL for ACF

The WPGraphQL documentation (October 2026) describes WPGraphQL for ACF as a plugin that adds ACF field groups and fields to a GraphQL schema; it requires WPGraphQL and Advanced Custom Fields to be installed and active, and the page does not mention Secure Custom Fields. Field Forge Pro registers the field groups of Field Forge in the schema itself, so a site that uses Field Forge does not install a separate plugin for it.


Ready for GraphQL custom fields?

See pricing →

WPGraphQL integration is included in every paid plan. Pro registers its types with WPGraphQL.

Forge AI Assistant Online

Hi! I'm the Field Forge AI assistant. Ask me anything about the plugin — setup, features, troubleshooting, or development.

Just now
Powered by Forge AI · Browse docs