If you’re in the business of creating WordPress plugins for yourself or for others, then it’s likely that you’ve done work with custom post types.
On top of that, there’s a chance that you’ve needed to introduce some functionality into a custom post type based on what’s selected in the plugin settings (which I discussed all of that fun stuff in a previous post).
And I’ve seen a number of different ways in which this is done: Some of them involve complexity such as reading the select post types into an array, iterating through the list, comparing the current post type, setting a boolean, and so on.
But there is a cleaner way that this can be done. I’m not claiming it’s the best way (perhaps you could share some insight on your opinions on this in the comments), but it’s way that I’ve found useful and that I’ve been using a few times over throughout several projects.


