Home Forums General Issues Post Object vs Relationship. Which should I use?


Post Object vs Relationship. Which should I use?

  • How do i know if i should use a post object or a relationship?

    I have 2 post types, events and speakers.

    I have created a schedule field in my events CPT and it is a repeater. One of the lines of the repeater is currently a post object where a user can choose a speaker for that time slot in the schedule. Should the relation type be post object or relationship?

  • Post object fields and relationship fields are basically the same thing with only a few differences.

    Post Object
    – Select a related post (or posts)
    – Default is only one post can be selected
    – when allowing multiple, the max allowed cannot be limited
    – returns a single post when not allowing multiple selections
    – returns an array of posts when allowing multiple selections

    Relationship field
    – Select a related posts (or posts)
    – Default is to allow multiple selections
    – Can be limited to a specific number, including 1
    – Always returns an array of posts, even if there is only one

    Other than the settings I listed above, the UI for the field is vastly different.

    As far as choosing a field by looking at what they do, for me it really depends on if you want to limit selections to something other than 1. If selections will be unlimited then there is no difference except for the UI that is used and I would choose the UI that will make the most sense to the person that will be doing the content management.

  • Some other (new?) differences that I find helpful are:

    • the Relationship field has the option to show a Featured Image preview
    • the Relationship field has the option to add additional filters like Post Type and Taxonomy to the actual field (instead of just pre-filtering in the field settings)
Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Post Object vs Relationship. Which should I use?’ is closed to new replies.