I have a custom post type that I need to basically return a 404 for if a user ever lands on it. I would like to just do something simple like hook into something before the single page is loaded, check the post’s custom fields for a value and then return a 404 if it matches something.
I can handle writing the function and returning the 404, I just can’t figure out which hook I should be using.