Remove Duplicates from Upcoming Events List
I have an event that is entered for performances on the same day at different times and I only want it to appear once for that date on the upcoming events list they are not Recurrences but Stand alone events. Is there a way to select distinct post_title from the query so it will appear once no matter how many times it is set to appear over the course of days?
I thought I could use pre_get_post but I don’t know how to ask for distinct post_title.
I don’t have any specific examples to hand, I’m afraid, and as this is customization territory it’s really something we’d need to leave in your hands (bearing in mind you will need to be responsible for the code’s future maintenance) 🙂
The Codex itself is probably the best source of information on using post__not_in but essentially you would use it to provide an array of post IDs for exclusion:
$args = array( /* ... other args ... */ 'post__not_in' => array( 10, 20, 30 ), /* ...more args ...*/ );
Of course you’d probably want to create the array of IDs dynamically and would create a separate query for that.
It’s been a while so I’m going to go ahead and close this topic.
- Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
- Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context