Skip to contentSkip to main navigation Skip to footer

Use ACF Fields in Squirrly SEO Schemas

Squirrly SEO Use ACF Fields in Squirrly SEO Schemas screen on a laptop

Squirrly SEO can fill any schema field with a value from an Advanced Custom Fields (ACF) field, through the patterns {{customfield(name)}} and {{customfields(field|key)}}. Each page then gets its own author, reviewer, price or date in the JSON-LD from one schema you set up once.

The schema forms that take these patterns need the Squirrly SEO Advanced Pack. The examples come from Squirrly SEO 14.2.9 with the Advanced Pack 2.5.11.

What you need

ItemWhere to check it
Squirrly SEO with JSON-LD Structured Data onSquirrly > All Features
The Advanced Pack with Custom Rich Snippets on (see custom schemas)Squirrly > All Features
Reusable Schemas on, to use one schema on many postsSquirrly > All Features
ACF, free or Pro, with the fields on your postsPlugins in WordPress
Squirrly SEO All Features cards for Custom Rich Snippets and Reusable Schemas
The two Advanced Pack switches in All Features. On the demo, Reusable Schemas is still off.

The two patterns

{{customfield(price)}}
{{customfields(location|address)}}
PatternWhat it returnsUse it for
{{customfield(name)}}The value saved in that field on the current post, as textText, Number, Date, Email and URL fields
{{customfields(field|key)}}One key of a field with several values, or one detail of the post or user the field links toGroup fields, Image fields and relation fields

Write the field name, not the label. ACF shows it under Field Name. Don’t put spaces inside the braces, because {{customfield( price )}} returns nothing.

What each key returns for a linked person

When the field is a Post Object, Relationship, Page Link or User field, the key reads from the profile it points to:

KeyLinked postLinked user
namePost titleDisplay name
urlPost linkAuthor page link
imageFeatured imageProfile picture (Gravatar)
descriptionExcerptBiographical Info
Any other key, such as job_titleThat ACF field on the linked postThat ACF field on the user’s profile

An Image field gives its URL whatever its return format is. A Text Area or a field with several values gives one item per line. If the field links to more than one person, Squirrly uses the first one, and a linked post must be published.

Show the real author and reviewer of each article

This setup reads the author and the reviewer from two ACF fields on each article. The field names written_by and technical_review_by are examples, so use your own and keep the same names in the patterns.

  1. In ACF, add written_by (a Post Object pointing to your People post type) and technical_review_by (a User field) to your posts.
  2. On each person’s profile, add job_title (Text) and same_as (Text Area, one profile link per line). Set the featured image as the person’s photo.
  3. Go to Squirrly > Reusable Schemas > Schemas, click Create Reusable Schema and pick Article.
  4. Fill the author and reviewer fields with the patterns from the table below.
  5. Type a Reusable Name and save the schema.
Schema fieldPattern
Author Name{{customfields(written_by|name)}}
Author URL{{customfields(written_by|url)}}
Author Job Title{{customfields(written_by|job_title)}}
Author Image URL{{customfields(written_by|image)}}
Author Same As{{customfields(written_by|same_as)}}
Reviewer Name{{customfields(technical_review_by|name)}}
Reviewer URL{{customfields(technical_review_by|url)}}
Reviewer Job Title{{customfields(technical_review_by|job_title)}}
Reviewer Image URL{{customfields(technical_review_by|image)}}
Reviewer Same As{{customfields(technical_review_by|same_as)}}

Now attach the schema to the articles:

ForDo this
Every post of a typeGo to Squirrly > Optimize > Automation, click the post type and pick the reusable schema in JSON-LD Type (see Automation)
One postOpen the post’s SEO Snippet, go to Rich Snippets and click Add Reusable Schema

Each article reads its own written_by and technical_review_by, so one schema covers all your authors. The reviewer goes on the article’s WebPage as reviewedBy, because schema.org defines it there. The article:author Open Graph tag then names the same person as the Article schema.

Use any other ACF field

The same patterns work in any schema field of the Advanced Pack, including a schema you add to one post with Add New Schema.

ExamplePattern
Product price{{customfield(price)}}
Event start date{{customfield(event_date)}}
Dataset license URL{{customfield(license_url)}}
LocalBusiness phone from a Group field{{customfields(contact|phone)}}

When you edit a schema on a post that already has custom fields filled in, the form lists those fields as patterns you can click. Reusable Schemas shows that list.

Troubleshooting

A schema field stays empty on every post

The field name in the pattern is wrong or has spaces inside the braces. Copy the name from Field Name in ACF.

The author is empty on some posts

Those posts have no value in the relation field, or the linked profile isn’t published. Fill the field and update the post.

“Not published yet – Google needs: …”

A required field of the schema resolved to nothing on that post. The message names the field, and the post needs a value in the ACF field behind it.

Frequently asked questions

Does this work with ACF Pro?

Yes, the patterns read ACF fields the same way in the free and the Pro version.

Can I use the patterns in the SEO title or description?

{{customfield(name)}} also works in titles and descriptions, as custom fields in SEO metadata explains.

What happens when a field links to two authors?

Squirrly uses the first one.

Was This Article Helpful?

0 Comments

There are no comments yet

Leave a comment

Before you leave

Future of AEO GEO and AI Search!

Free Now. Free Forever.

It’s time to stop orbiting SaaS.

Be the Meteor.

10 Elite Tools. 1 Stack.