WP Manifestindependent plugin directory
manifest / content / acf-post-object-enrichment

ACF Post Object Enrichment

Adds a UI to ACF Post Object and Relationship fields to automatically attach additional ACF field values to each returned WP_Post object.

by SnippetNest · github.com/zackpyle/acf-post-object-enrichment · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/zackpyle/acf-post-object-enrichment/archive/refs/heads/main.zip

Readme

ACF Post Object Enrichment

Automatically attach additional ACF field values to every WP_Post object returned by an ACF Post Object or Relationship field — no extra get_field() calls needed in your templates.

How it works

The plugin adds an "Attach additional fields" setting to the ACF field editor for Post Object and Relationship fields. Select which ACF fields you want pre-loaded, and those values will be available as properties directly on every WP_Post object the field returns.

// Without this plugin
$posts = get_field( 'featured_articles' );
foreach ( $posts as $post ) {
    $hero = get_field( 'hero_image', $post->ID );
    $date = get_field( 'publish_date', $post->ID );
}

// With this plugin (after selecting hero_image + publish_date in the field settings)
$posts = get_field( 'featured_articles' );
foreach ( $posts as $post ) {
    $hero = $post->hero_image;
    $date = $post->publish_date;
}

Requirements

Installation

  1. Download or clone this repository into your wp-content/plugins/ directory.
  2. Activate ACF Post Object Enrichment from the WordPress Plugins screen.

Auto-updates are delivered via GitHub — the plugin will appear in your WordPress updates dashboard whenever a new release is published.

Usage

  1. Open any ACF field group and edit a Post Object or Relationship field.
  2. Scroll to the "Attach additional fields" setting.
  3. Click + Add field and select the fields you want attached. The picker shows all ACF fields registered for the post types the field targets.
  4. Save the field group.

From this point on, get_field() (or the_field()) for that field will return WP_Post objects with the selected fields already populated as properties.

Note: The enrichment setting is hidden when the Post Object field's Return Format is set to Post ID, since enrichment only applies to object returns.

Example Use Case

Say you have a Books post type and a Post Object field called featured_books that lets editors pick a handful of books to highlight. Each book post has two custom fields: book_author (text) and book_genre (text).

In the ACF field group editor, find the featured_books field and use the Attach additional fields setting to add book_author and book_genre — just click + Add field for each one.

Now in your template, each book post object already has book_author and book_genre ready to go:

$books = get_field( 'featured_books' );
foreach ( $books as $book ) {
    echo $book->book_author;
    echo $book->book_genre;
}

No nested get_field() calls needed.

Notes

  • Values are resolved using get_field(), so they respect ACF's formatting — images return arrays, relationships return arrays of WP_Post objects, etc.
  • The picker auto-detects which post types the field targets and scopes the field list accordingly. It falls back to all available ACF fields when no post type filter is set.
  • Field names are stored as a comma-separated string internally.

License

GPL-2.0-or-later — see LICENSE.

Author

Built by SnippetNest. Plugin detail page: snippetnest.com/snippet/extend-acf-post-object-relationship-fields-custom-data.

Read the full README on GitHub →

Releases

TagPublished
1.0.1 May 24, 2026
1.0.0 May 24, 2026

These releases are tags only. The author does not attach a packaged zip, so there are no download counts to report.