最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

404 error - WP function won't work on 404 template page

programmeradmin2浏览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?

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?

Share Improve this question asked Mar 10, 2022 at 13:08 X9DESIGNX9DESIGN 1699 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论