Custom post type returns bad post ID August 16, 2022 by Tarik Billa Use the following before $post->ID in your code: global $post