show “updated date” of a post
-
Hey!
I’m trying to figure out, if and how I can show the date when a post was updated next to the published date.
I tried it with a code snippet via the functions.php but it gives me a fatal error because of Call to undefined function. And I don’t want to experiment too much and ruin sth, so I rather ask, if there’s a chance to activate that somehow.The snippet, I try it with is the following:
$u_time = get_the_time(‘U’);
$u_modified_time = get_the_modified_time(‘U’);
if ($u_modified_time >= $u_time + 86400) {
echo “
Last modified on “; the_modified_time(‘F jS, Y’); echo ” at “; the_modified_time(); echo ” “; }
source: https://www.wpbeginner.com/wp-tutorials/display-the-last-updated-date-of-your-posts-in-wordpressThe error I get is the following:
Fatal error: Uncaught Error: Call to undefined function get_the_time() in /var/home/[…]/wp-includes/functions.php:8448
Thank you!
- The topic ‘show “updated date” of a post’ is closed to new replies.