I have this problem where the publish date sometimes appears and sometimes it does not.

I am using ACF relationship field to find the story and then bring it to my front page.

<?php the_date(); ?>

If I open the story and re-publish it with a new publish date it works.


enter image description here


From the the_date() documentation:

Will only output the date if the current post’s date is different from the previous one output.

i.e. Only one date listing will show per day worth of posts shown in the loop, even if the function is called several times for each post.

[Emphasis mine]

You're almost certainly looking for get_the_date(), which you would use like this:

<?php echo get_the_date(); ?>
| improve this answer | |

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