Display content from custom post type if match to main post category
A better solution than the one you found on your own, would be to only retrieve matching posts in the first place. As is, you are potentially retrieving the wrong data. With your code (your solution), what happens if the two posts in the result set don’t match? You get no output at all. Your … Read more