I have created a view of a single content type in a table. Term data is not displayed for unpublished and scheduled nodes within the table.

  • Some of the nodes of that content type are published, some are unpublished, some are scheduled to be published.
  • The content type has a taxonomy term field using Entity Reference. Only one term can be chosen.
  • When the term field is added to the display, it is empty for scheduled nodes, even though a term value has been assigned to them correctly.
  • The value in the term field appears correctly for published nodes.
  • When a node is published, the term field shows the correct value for that node.

I believe the underlying issue is the same as in https://www.drupal.org/node/1967812, particularly as described in https://www.drupal.org/node/1967812#comment-7328504. However, I've posted this since it is a simpler use case that is more easily reproduced.

I have found the following workaround to this use case. It assumes you are using Entity Reference rather than Term Reference.

  • Add a relationship to the view using Entity Reference: Referencing entity (specify the term field)
  • This adds new Taxonomy fields to the list of available fields.
  • Add the Taxonomy term: Name field to your view. The taxonomy values will be returned correctly for unpublished nodes.

You can also use this approach to filter the view to a single term. Filtering to multiple terms is possible but complicated. It doesn't work so well as an Exposed filter since it doesn't provide you with a list of terms to use in your filter - you have to manually type the term you want to filter on.

Comments

millionleaves created an issue. See original summary.

millionleaves’s picture

Title: Taxonomy Term fields are empty for nodes that are scheduled » Taxonomy Term fields are empty for nodes that are unpublished

Edited title

saurabh.dhariwal’s picture

Its simple solution for this and not need to add any relationship. Add content: YOUR TERM field to display and it display term of unpublished node.

Hope it helps you.

Thanks!