I have a query returning a list of tags based on my search criteria. I am looking for a way to return a list of posts for these tags however I would like to exclude redundant posts from the results.

for instance tag list is A, B, C, D. I want a total of 4 posts. If the most recent post for A is also tagged B I would like a different result for tag B and so on.

  • I'm struggling to come up with something more efficient than four queries using an accumulating "not in" list :-s – Andy Macaulay-Brook Jul 25 '16 at 18:35
  • In fact it's harder too - you don't want choices for the first few tags to run you out of options for later tags, do you? – Andy Macaulay-Brook Jul 25 '16 at 18:36
  • My hopes are I wouldn't be run out of posts, but I guess my next best option would be to drop that tag and use the next one. Are you feeling a separate query for each tag appending the post id to a "not in" statement is my best option? That's really where I am, but trying to save on making so many queries. – stoi2m1 Jul 25 '16 at 18:49
  • Yeh. I can't convince myself that anything else is possible. If it were me I'd make an editor (as in a human) choose a featured post per category instead. – Andy Macaulay-Brook Jul 25 '16 at 18:52
  • thanks @AndyMacaulay-Brook but Im looking for a way to show popular tags, not featured tags – stoi2m1 Jul 25 '16 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.