ACF Post Object / Relationship Field

Forums › Forums › Search & Filter Pro › ACF Post Object / Relationship Field

Viewing 3 posts – 1 through 3 (of 3 total)
  • Anonymous
    #107537

    I understand as of January there is support for ACF Relationship Fields (and as they work the same pretty much I am assuming Post Object field too).

    I have everything working almost perfectly. I am setting up a custom results.php page, but I noticed that if I include the ACF recommended loop reset – <?php wp_reset_postdata(); ?> that it monkeys with trying to access individual results post data. For example, <?php the_title(); ?> results in the overarching page title where my results shortcode is, instead of the the title of search/filter post. If that makes sense.

    Sooo, should I just remove the query reset, because it works if I do, or will cause other issues? What is the recommended practice in other works for using ACF Relationship field with Search & Filter? Thanks!

    Trevor
    #107577

    I understand as of January there is support for ACF Relationship Fields (and as they work the same pretty much I am assuming Post Object field too).

    Correct. We still do not support the more complex field types (like repeater). We also do not support the fetching of data from with a related post of a Post Object (so, if that Post Object had a Custom Field with data in, it would not see that). This support simply fetches the related Post ID and Title (I think).

    You should not use the ACF documentation for fetching the data in that regard (i.e. do NOT use wp_reset_postdata(), as no reset is needed. Our loop does it for you.

    Anonymous
    #107635

    Gotcha, thanks for the update. Hopefully ACF Post Object will support Custom Fields with Search & Filter soon too then. 🙂

    I guess my code worked because all I was grabbing from the ACF Post Object was the title. Only thing I noticed is I had to pass get_the_title the $post_object var, like so, whereas the ACF instructions didn’t say that was necessary:

    <?php $instructor_name = get_the_title( $post ); ?>

    And thanks for the confirmation not to use wp_reset_postdata().

    Cheers!

Viewing 3 posts – 1 through 3 (of 3 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.