> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/meta-fields/field-types/relational-field.md).

# Relational field

How to define typed relationships between WordPress objects using ACPT fields

{% hint style="info" %}
"Relational" is not a standalone field type. It is a **relationship feature** that can be applied to **Post**, **Term**, and **User** object fields. When you configure a relationship on one of those fields, ACPT lets you define the cardinality and direction of the link between two WordPress entities.
{% endhint %}

To configure a relationship, select any Post, Term, or User object field and open its settings. The relationship panel will appear:

<figure><img src="https://3235524095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiyf0tSKPgXiyoQ3zV3I6%2Fuploads%2Fgit-blob-0b6f94bdbb71a90ac0b615b0455f56742d68904e%2FManage-meta-fields-%E2%80%B9-Localhost-%E2%80%94-WordPress%20(2).png?alt=media" alt=""><figcaption></figcaption></figure>

### From, to, relation

From the left to the right you have:

* **From** - The first entity involved in the relation
* **To** - The second entity involved in the relation
* **Relation** - The relationship between the selected entities

If you select a bidirectional relation (see below), a new box called `Inversed field on target post` will be displayed.

<figure><img src="https://3235524095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiyf0tSKPgXiyoQ3zV3I6%2Fuploads%2Fgit-blob-2e68878ff93958cb7126a4863113864cba2ab11d%2FManage-meta-fields-%E2%80%B9-Localhost-%E2%80%94-WordPress%20(3).png?alt=media" alt=""><figcaption></figcaption></figure>

Choose the corresponding field type.

Automatically this field type will be set as a relationship one (inversed of the selected one).

### Relationships types

* **One-to-One - Unidirectional -** The current object can be related to one object
* **One-to-One - Bidirectional** - The current object can be related to one object and there is an inversed field on the target object
* **One-to-many - Unidirectional -** The current object can be related to many objects
* **One-to-many - Bidirectional** - The current object can be related to many objects and there is an inversed field on the target object
* **Many-to-one - Unidirectional** - Many objects belonging to the current object can be related to one object
* **Many-to-one - Bidirectional** - Many objects belonging to the current object can be related to one object and there is an inversed field on the target object
* **Many-to-many - Unidirectional** - Many objects belonging to the current object are related to many objects
* **Many-to-many - Bidirectional** - Many objects belonging to the current object can be related to many objects and there is an inversed field on the target object

#### Example

Suppose you have two custom post types: one called **Florist** and one called **Flower**.

The Florist may have many flowers, and any flower belongs to only one Florist.

Create a field called `flowers` on the Florist and a field called `florist` on the Flower (create them as simple text).

Then, go to Florist and transform the `flowers` fields in a **One-to-many** bidirectional relation:

* Select Flower as **From** entity
* Select Florist as **To** entity
* Select **One-to-many** **bidirectional** as the relation
* Select `florist` as field target

Done. On the Flower side, the `florist` field is now automatically configured as a **Many-to-one** bidirectional relation.

### Restrict to logged-in user posts

{% hint style="info" %}
This option is available for **Post**, **Post Multiple**, and **Relational** fields.
{% endhint %}

Enabling **Restrict to logged-in user posts** in the field's advanced options filters the post selector so that it only lists posts authored by the currently logged-in user.

This is useful for front-end forms where editors or contributors should only be able to link their own content — for example, letting a user attach only their own "Portfolio" entries to a "Project" post, without seeing or selecting posts owned by other users.
