How to get the post_name when in preview? June 6, 2022 by Tarik Billa is_preview() is supported. You may also want to look into is_singular() which covers posts, pages, and attachments.