Skip to content
Advertisement

Display last date a post was updated on WordPress

I’m using some PHP to display the last time a blog post was updated on WordPress using the get_the_time and get_the_modified_time functions. However, I can’t get the last modified time to display inline in the paragraph.

JavaScript

Here’s a screenshot of the result:

Screenshot

Advertisement

Answer

the_modified_time prints the last modification time, so it prints it before you print your <p>.

Instead you’ll want to use get_the_modified_time for setting $t, like so:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement