Empty array when calling get_connected()

Support MB Relationships Empty array when calling get_connected()Resolved

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #42562
    Christopher AlvarezChristopher Alvarez
    Participant

    For some reason I can't seem to get the connected posts when viewing in a single-[cpt] template.

    My relationship is called Episodes to Shows
    My custom post types are episodes and shows

    I set up the relationship using the UI to have Episodes in the 'from' section and Shows in the 'to' section. I'm running through some data and creating new custom posts of type "episodes," then setting meta fields (using MB Custom Fields api) and finally setting up the relationship between the new episode, and the show I am connecting it to.

    Here's a bit of the code: https://pastebin.com/YQK9Pf8D

    Anything I should try? What am I missing? Love the MB Relationships plugin and have had success with it so far!

    #42574
    Christopher AlvarezChristopher Alvarez
    Participant

    🤦🏻‍♂️ Wow... of course it was a simple mistake. If the new custom posts are in draft mode, they won't appear in the loop and therefore won't display on the page. Publishing the episode posts was all I needed.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.