Getting post id in for loop October 19, 2022 by Tarik Billa If you’re looking to get the post id to say add it to a div use the_ID() <div id="post-<?php the_ID(); ?>">