Fixed a regression from previous commit

Fixed a regression from commit 5d7f27b198d81ffe02bfe1c156c6e7b2e53184e0
where the post type would not be properly set for pages(and maybe
posts).