Place the below code to your themes functions.php or inside your plugin and the [return_post_id] shortcode will print the post ID.

Quelle: Get post id shortcode – WordPress Development Stack Exchange