[post_id]
The shortcode to display the current post’s ID.
Product
Shortcode Attributes
- label – A string that will be displayed as a label before the post ID. If not provided, no label will be shown.
- Options: Any text value
Shortcode Enclosed Content
Any content placed between [post_id] and [/post_id] will be used as a template, where {content} acts as a placeholder for the post ID.
Example Usage
[post_id]
[post_id label="Post ID:"]
[post_id]The ID of this post is: {content}[/post_id]
Results
| Example 1: Display Post ID Without a Label: 123 (where 123 is the ID of the current post)Example 2: Display Post ID With a Label: Post ID: 123Example 3: Display Post ID With Custom Content: The ID of this post is: 123 |
If no post ID is found, the shortcode will output nothing.