Support

Account

Home Forums Front-end Issues Relationship field, show private posts/threads

Solved

Relationship field, show private posts/threads

  • I’m currently using bbpress for forums and would like to show private threads (just the tiles) on a page.

    On that page, I have a relationship field that shows topics and they can be selected. If you then go to that page and you’re not logged in, nothing appears. If you are logged in, the titles of the three topics show up, so the actual code to display it is correct, I think.

    I’m currently using the field in the following way:

    <?php
    $topics = get_field('topics');
    foreach($topics as $topic) {
        echo get_the_title($topic->ID);
    }
    ?>

    (Some code omitted)

    If I do a var_dump on $topics, it has nothing when not logged in, 3 objects when logged in. Seems to me like I would have to modify get_field some how, but I didn’t see anything in the documentation or during my searches.

  • Solved my own question..

    Previously I was returning Post Objects from my relationship field. Just switched it to Post IDs and from there could use those to get the permalink, title, whatever.

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

The topic ‘Relationship field, show private posts/threads’ is closed to new replies.