0

I made a custom template of error 404 page. In my header.php i use the_time() function to display current date. There is some problem with 404 page because the_time() function won't work, not return any date. Why is that happen?

1 Answer 1

2

the_time does not display the current date, it displays the date of the current post, and 404 pages do not have a current post.

For this reason, if it ever returned a date on the 404 page then it would be a bug.

Instead you should use the PHP functions that come with PHP to display the current date and time.

1
  • Thank you. I didn't read about this function properly. I just copied it from the WP developers documentation site and paste into my code. :) My fail and mistake.
    – X9DESIGN
    Commented Mar 10, 2022 at 23:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.