I am trying to: Display a view inside a layout. I have a custom post type named 'Hotels' and a custom post type named 'Reviews. They have a one-to-many relationship. Each hotel can have multiple reviews. But the reviews are not showing up.
Link to a page where the issue can be seen: hidden link
I expected to see: List of reviews.
Instead, I got: No reviews.
Hi, can you take screenshots of the View in wp-admin so I can see how your Query Filter is configured?
Attached is the screenshot showing the query filter.
I can see your Ordering settings are based on a custom field Review Date. Since you are sorting based on that custom field, if the Reviews do not have a set Review Date, then they will not appear in the search results. It's a quirk in the way WordPress queries work. If you change the ordering to Post Date instead, do the Reviews appear?
I changed the sorting from 'Review Date' to 'Post Date'. The reviews started appearing.
I am now rechecking the review date for each review. This is a bit strange as the 'Review Date is a required field.
I will recheck and get back shortly.
I checked. Each review has a review date. It is a required field.
Okay is it possible there is more than one custom field called Review Date, and the wrong Review Date field is selected in the Ordering options? Sometimes this happens if fields are renamed or deleted incompletely. If that is not the case, I will need to take a closer look. Please provide login credentials in the private reply fields here and let me know where I can find this View on the front-end of the site.
I checked the list of custom fields... found a field named 'Review Date' with the slug 'review-date' It was not linked to the Reviews custom post type fields group. Deleted it.
Then selected the correct field 'Review Date' with the slug 'reviews-date'. The reviews are now showing up.
Thank you for the help 🙂