---
title: "Relationship Field in WordPress"
url: https://nexterwp.com/docs/wordpress-relationship-field/
date: 2026-11-12
modified: 2026-11-12
lang: en
author: "Aditya Sharma"
description: "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..."
image: https://nexterwp.com/wp-content/uploads/2026/09/wordpress-relationship-field-1024x519.jpg
word_count: 594
---

# 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.

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

- Go to **Nexter → Content Fields** and open the **Group Fields** tab.

- Open a field group, or create a new one.

- Click **Add Field**.

![A field group open with the Add Field button](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-shared-add-field.webp)

- Set **Field Label** to *Similar properties*. The **Field Name** fills in automatically and is what you use in code.

- Set **Field Type** to **Relationship**.

![The Field Type dropdown listing the available field types](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-shared-field-type.webp)

- Under **Filter by Post Type**, choose which post types editors may pick from.

![The Relationship field settings in the Content Fields builder](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-similar-settings.webp)

- Turn on **Filters** to give editors search, post-type and taxonomy filters in the picker.

- Set **Return Format** — IDs are the safe default.

- Click **Update**.

![The Relationship field as it appears on the post editing screen](https://nexterwp.com/wp-content/uploads/2026/09/nxt-fields-h-similar-editor.webp)

## 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

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Filter by Post Type** | | *No help text in the UI.* |
| **Filter by Post Status** | | *No help text in the UI.* |
| **Filter by Taxonomy** | | *No help text in the UI.* |
| **Filters** | | *No help text in the UI.* |
| **Search** | | *No help text in the UI.* |
| **Post Type** | | *No help text in the UI.* |
| **Taxonomy** | | *No help text in the UI.* |
| **Return Format** | | *No help text in the UI.* |

### Validation

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Required** | | *No help text in the UI.* |
| **Minimum Posts** | | *No help text in the UI.* |
| **Maximum Posts** | | *No help text in the UI.* |

### Presentation

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Instructions** | | *No help text in the UI.* |
| **Elements** | | *No help text in the UI.* |
| **Featured Image** | | Details to show against each result |
| **Wrapper Attributes** | | *No help text in the UI.* |

### Conditional Logic

| Setting | Options | What it does |
| ------- | ------- | ------------ |
| **Conditional Logic** | | *No 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

- [Create your first field group](https://nexterwp.com/docs/create-a-field-group-wordpress/)- [Display a field value on the front end](https://nexterwp.com/docs/display-custom-field-value-wordpress/)

## Frequently Asked Questions

**Q: Why is my WordPress relationship field picker showing nothing?**
A: 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.

**Q: How do I display related posts from a WordPress relationship field on the front end?**
A: 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.

**Q: What is the best return format for a WordPress relationship field?**
A: 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.

**Q: Can I use a WordPress relationship field for bundle products or similar content?**
A: 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.

**Q: Why does a linked item show up as a blank list item?**
A: 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.

**Q: Is a WordPress relationship field one-way or two-way?**
A: 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.
