Home Forums General Issues Relationship without link for draft pages


Relationship without link for draft pages

  • Hi,

    To explain my problem I will take the example of a movie critic. I created 1000 pages of movies, and on these pages there is the name of the director, later there will also be a page for each director and the name of the director will become a link. I tried to create a draft page of these directors and to insert them with the relationship field but this creates a 404 link to the draft page that doesn’t exist yet…

    Do you know another way ?

  • You need to test the status when looping over the fields in the relationship field

    $directors = get_field('directors');
    foreach ($directors as $director) {
      if ($director->post_status != 'publish') {
        // not published, skip it
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Relationship without link for draft pages’ is closed to new replies.