[post_published_date]
The shortcode displays the published date of a post.
Product
Shortcode Attributes
- id – Post ID whose featured image you want to display.
- Options: Any valid post ID.
- label – A label above the featured image.
- Options: Any text value.
- date_format – Used to change the returned date format.
- Default: Based on the set WP Options Date Format.
- Options: Refer to WordPress Date and Time Formatting.
Shortcode Enclosed Content
Any content placed between [post_published_date] and [/post_published_date] will be used as a template, where {content} acts as a placeholder for the post published date.
Example Usage
Example 1
[post_published_date id="123"]
Results
| This example returned the published date of post ID 123. |
Example 2
[post_published_date date_format="F j, Y" label="Published on:"]
Results
<label>Published on:</label>
February 27, 2025
| This example returned the published date with specify a custom date format and a label before the date. |
Example 3
[post_published_date]This post was published on {content}.[/post_published_date]
Results
This example returned custom content, using {content} as a placeholder for the date:This post was published on 27/02/2025. |