Support

Account

Home Forums Backend Issues (wp-admin) Relationship Field: Post Types not displaying correctly

Solving

Relationship Field: Post Types not displaying correctly

  • I have a Relationship Field called “Featured Content” by which I can select posts from many different Custom Post Types to build a feaured section.

    I set the options to display both the Thumbnail and the Post Type in the list, so it looks like this:
    Relationship Field before saving/updating

    So far so good!
    But when I click on Save or Update the post/page, it replaces the correct Post Types of the added contents by the Post Type of the post/page the Relationship field is in (in this case it is in a page). Like this:
    Relationship Field after saving/updating

    Is this the intended behaviour?
    Otherwise, anyone can guess what’s going on?

    P.S.: I’ve been working on this site for some months, and I created this relationship field a while ago, so I can’t remember how it was working, but I guess it was working fine, otherwise I’d have realized this problem before…
    I tried to create different Relationship fields, with different options, in different pages, and nothing is working.
    I also tried to “downgrade” WordPress to 3.8.x and the ACF plugin to 4.3.5, and it’s still not working…

  • Hi all,

    I have exactly the same problem than miguel. Did you find a solution?

  • Unfortunately I didn’t so far.
    Actually I’ve not worked on that particular issue since I wroted the question, but I guess if I don’t receive any better suggestion, I’ll try to use the filter acf/fields/relationship/result to customize the HTML correctly. I’d try to grab the post type of each row and manually set the correct text for each row.
    I think that should work. I’ll comment when I try…

  • Well, I downgraded to a version that I knew it was working (Version 4.1.6) and now everything is working so, it’s seems to have to do with the new version.

  • Ok, it’s good to know!
    Now I’d expect a comment from the creator confirming this is a bug and telling whether it may be fixed in next release…

  • I’m having exactly the same problem. Hope the developer will weigh in soon!

  • The actual bug is in advanced-custom-fields/core/fields/relationship.php in line 496:

    At the moment it is: $post_type_object = get_post_type_object( get_post_type( ) );

    And it should actually be: $post_type_object = get_post_type_object( get_post_type( $p->ID ) );

    Otherwise it is getting the post type of the current post, intead of the selected post for the relationship block…

  • Hi guys.

    Thanks for the bug report. This has been fixed and can be found on github:
    https://github.com/elliotcondon/acf

    Thanks
    Elliot

  • When will the new version of the plugin be released with the fix?

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

The topic ‘Relationship Field: Post Types not displaying correctly’ is closed to new replies.