Support

Account

Home Forums Feature Requests Output options for Relationship field

Solved

Output options for Relationship field

  • I noticed that when I use the Relationship field, the output is always an WP Post object. Sometimes I want to use the Relationship field (because it offers a great interface for my clients to find the post/page/etc they are looking for), but only output the post ID. (because maybe I only want to put a link on the page, or just the post’s featured image). Then getting the whole postobject would seem a lot of overhead to me…

  • Hi Hetgelaat!

    I think you’ve got a point so I made some alterations to the relationship-field myself 🙂 This will allow you to choose wether to have it return the post objects or just ids

    I’ll attach it here. In order to use it simply drop it into plugins/advanced-custom-fields/core/fields and replace the relationship.php

    @elliot , I will push this fork for you on github so you can choose to add it in or not 🙂

    • Elliot

    • August 7, 2013 at 3:07 pm

    Hi @jonathan

    Thanks mate, I’ll add this in!

  • You guys are awesome! This is exactly what I had in mind!

  • Great Hetgelaat!

    Please mark my answer as the topic solution tho 🙂

  • Hi Jonathan, I marked my reply as ‘solving the issue’, since then, the buttons to mark YOUR post as the solution have disappeared. Would this be a bug in the forum (@elliot)? or do I miss something?

    BTW: the fix was done on the git-source (I suppose), so initially your relationship.php broke the ACF plugin (version 4.2.0). I moved your changes to the relationship.php from 4.2.0 and that worked!

  • Hi,
    Alright 🙂

    Yeah Elliot mentioned that it would not be possible for him to simply copy over the entire file since changes had been made to the field in the latest update but rather he had to copy over the changes!

    • Elliot

    • August 12, 2013 at 12:21 pm

    Hey guys,

    This is now part of v2.4.1,

    Thanks for you help.

    Cheers
    E

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.