What is the ID of an WordPress post?

When I create / edit a post, I want to know its internal ID, because when I use images I name them based on the post’s ID. For instance, this post has the ID 63, and the images I use for it will be called 63.1.png, 63.2.png etc.

When I edit an existing post, I can see its id as part of the URL, like in the picture below:

When I create a new post, the address bar doesn’t contain the post’s ID, as WordPress hasn’t assigned yet a number to that post.

To force WordPress to assign a post ID, I just press Enter key. In the image below you can see that the address bar contains now the post’s ID.

No matter how many times I edit a post or change its permalink, the posts’s internal ID stays the same.

Join LUNLUN.com's free newsletter.

Leave a Reply