Skip to content

Relationship Field in WordPress

Key Takeaways

  • Nexter Extension 4.9.0 añade el tipo de campo Relationship, pero solo con Nexter Pro Extensions 4.8.0 o posterior; sin Pro no aparece al añadir un campo y un campo existente queda bloqueado y de solo lectura.
  • Relationship guarda una lista ordenada de entradas elegidas desde un listado buscable y filtrable, y los filtros permiten limitar la selección por tipo de contenido, estado o taxonomía, por ejemplo para “Similar properties”.
  • Relationship es unidireccional y almacena los valores como un array serializado; borrar una entrada vinculada deja su ID guardado y no la expone por defecto en la WordPress REST API.
Table of Contents

A relationship field lets an editor connect one post to others — related properties, similar recipes, the products in a bundle — by searching and picking them, in an order they control.

Requires Nexter Extension Pro. From Nexter Extension 4.9.0 the Relationship field type ships with Nexter Pro Extensions 4.8.0 or later. Without Pro it is not offered when you add a field, and an existing Relationship field is shown as locked: its saved value is kept read-only and is never cleared when you save the post.

What It Does

The field shows a searchable, filterable list of posts and stores the ones chosen, in order. Filters let you narrow what an editor can pick, so a “Similar properties” field offers properties and nothing else.

Before You Start

  • Nexter Extension is installed and active.
  • Content Fields is enabled under Nexter → Content Fields.
  • You have a field group, or are about to create one.
  • Nexter Pro Extensions 4.8.0 or later — the Relationship field type requires Pro.

Add a Relationship Field

  1. Go to Nexter → Content Fields and open the Group Fields tab.
  1. Open a field group, or create a new one.
  1. Click Add Field.
A field group open with the Add Field button
  1. Set Field Label to Similar properties. The Field Name fills in automatically and is what you use in code.
  1. Set Field Type to Relationship.
The Field Type dropdown listing the available field types
  1. Under Filter by Post Type, choose which post types editors may pick from.
The Relationship field settings in the Content Fields builder
  1. Turn on Filters to give editors search, post-type and taxonomy filters in the picker.
  1. Set Return Format — IDs are the safe default.
  1. Click Update.
The Relationship field as it appears on the post editing screen

Field Settings

Every field is configured across four tabs. These are the settings this field type offers, read from the field group builder in Nexter Extension 4.9.0.

General

SettingOptionsWhat it does
Filter by Post TypeNo help text in the UI.
Filter by Post StatusNo help text in the UI.
Filter by TaxonomyNo help text in the UI.
FiltersNo help text in the UI.
SearchNo help text in the UI.
Post TypeNo help text in the UI.
TaxonomyNo help text in the UI.
Return FormatNo help text in the UI.

Validation

SettingOptionsWhat it does
RequiredNo help text in the UI.
Minimum PostsNo help text in the UI.
Maximum PostsNo help text in the UI.

Presentation

SettingOptionsWhat it does
InstructionsNo help text in the UI.
ElementsNo help text in the UI.
Featured ImageDetails to show against each result
Wrapper AttributesNo help text in the UI.

Conditional Logic

SettingOptionsWhat it does
Conditional LogicNo help text in the UI.

When to Use It

  • Related or similar items on a listing.
  • The products included in a bundle.
  • Sources or references attached to an article.

Display the Value

With IDs returned, loop them and fetch what you need:

<?php
$ids = nxt_field_value( 'similar' );
foreach ( (array) $ids as $id ) {
    printf(
        '<li><a href="%s">%s</a></li>',
        esc_url( get_permalink( $id ) ),
        esc_html( get_the_title( $id ) )
    );
}

Limitations

  • The relationship is one-directional. Picking B on post A does not make A appear on B — add a second field, or set that up in code, if you need both sides.
  • Values are stored as a serialized array, so they are not exposed through the WordPress REST API by default.
  • Deleting a linked post leaves its ID stored. Check each post still exists before rendering.

Troubleshooting

The picker shows nothing

A filter is excluding everything. Check Filter by Post Type and Filter by Post Status — restricting to a status the posts do not have will empty the list.

A linked item renders as a blank list item

That post was deleted or moved to trash. Guard with get_post_status( $id ) before rendering.

Related Docs

Share your Thoughts

Still in Doubt? Let’s Assist You

Have Feedback or Questions?

Join our WordPress Community on Facebook!

Related Frequently Asked Questions

Why is my WordPress relationship field picker showing nothing?

A filter is usually excluding every post in the list. Nexter Extension’s Relationship field can filter by post type and post status, so a restrictive combination can leave the picker empty even when content exists. The quickest fix is to widen those filters until at least one matching post appears. That matters because the field only shows posts that pass the current filters, not every post on the site.

How do I display related posts from a WordPress relationship field on the front end?

The field stores selected posts as IDs when you use the safe return format, so the front end loop needs to turn each ID into a permalink and title. The page’s example uses `nxt_field_value( 'similar' )`, then `get_permalink( $id )` and `get_the_title( $id )` inside a list item. That pattern keeps rendering simple and avoids guessing at stored data structure.

What is the best return format for a WordPress relationship field?

IDs are the safe default because they are easy to loop through and fetch whatever you need later. That matters when you want control over markup, links, or titles instead of relying on a prebuilt output shape. Nexter Extension’s Relationship field lets you choose the return format, but the page specifically calls out IDs as the safer option for front-end rendering.

Can I use a WordPress relationship field for bundle products or similar content?

That is exactly the kind of use case this field fits. The page calls out related or similar items on a listing, products included in a bundle, and sources or references attached to an article. Because editors search and pick posts in an order they control, it works well when one item needs a curated set of linked content rather than an automatic archive.

Why does a linked item show up as a blank list item?

That usually means the linked post was deleted or moved to trash, so the stored ID still exists but no longer points to live content. The page recommends guarding with `get_post_status( $id )` before rendering. That check matters because relationship fields store IDs as serialized arrays, so stale references can survive even after the original post disappears.

Is a WordPress relationship field one-way or two-way?

It is one-directional by default. Picking B on post A does not make A appear on B, so reverse relationships do not happen automatically. If you need both sides, the page says to add a second field or set it up in code. That design choice matters when you are modeling pairs like related properties or linked references.

Last reviewed: November 12, 2026

Related Docs