narliecholler
narliecholler

Reputation: 479

Mapping Advanced Custom Fields from WordPress to components in my Next.js frontend through GraphQL, best methodology?

So I am building a website using WordPress as the headless CMS and NextJs as my frontend. I have the free ACF version and I want to dynamically query and map ACF to components in Next when I dynamically create routes on the frontend.

Is this possible with the free version or do I have to expose my ACF endpoints differently to be able to query dynamically? I can't really find any resources that help me in this instance without queries using the 'Content' field of pages in their query, but ACF isn't present in that field.

Upvotes: 0

Views: 1227

Answers (1)

I'm Joe Too
I'm Joe Too

Reputation: 5860

You can do this. What you'll need is a two-step approach:

  1. Use a plugin like this to make the ACF fields available via the WordPress REST api, then
  2. Build your graphql schema and translate the ACF fields to your schema in your resolvers or datasource.

Upvotes: 1

Related Questions