I just upgraded to WP 4.7, and suddenly code that uses get_post_type($id) stopped returning anything, and didn't throw an error either.
After trying a few things, I found that it would start working again if I changed my code from
But I can't find anything in the docs about WP suddenly requiring explicit integer values. Anyone else seeing this?
So, using trim instead of intval works too.
And checking $id
(preg_match('/\s/',$id)) shows that it had a space. But oddly, this worked just fine in WP 4.6, so something must have changed to make that less forgiving in WP 4.7