Support

Account

Home Forums ACF PRO How to get the number of posts from Relationship field? Reply To: How to get the number of posts from Relationship field?

  • Hi @jonathan

    It’s work correctly in the case, when I need to get from Relationship field the number of posts – of custom post type “movies”: – given that on the page of edit/creation new post of custom post type “movies” i have this relationship field “movies_of_this_producer”. And in this relationship field “movies_of_this_producer” i can choose a corresponding “producer” post.

    But if i need to get (from Relationship field) the number of posts – of custom post type “producers”: – it’s work incorrectly.
    *Posts of custom post type “producers” – have the “reverse” relationship with posts of custom post type “movies” via relationship field “movies_of_this_producer”.

    I created a new topic with a detailed description of this problem and with my code examples: http://support.advancedcustomfields.com/forums/topic/how-to-get-the-number-of-posts-from-relationship-field-for-reverse-posts/

    Tell me please, what code should be used in case with posts, that have “reverse” relationship?