ACF Pro Datepicker Without Date Displays As Today's Date On Front-End

Hi,

I have an ACF Pro datepicker field in one of my post types. Where there is a known valid date, it will be either entered manually through the appropriate field in the post, or will be imported along with other data using WP All Import.

When there is no date to be entered, the field will remain as it is in the first screenshot below, whilst in the WP All Import import, there will be a null or blank value.

However, in either scenario, today’s date is shown on the front-end.

The affected field is rendered using dynamic content using this code: Date of Death: {{dc:acf:post_field field="date_of_death" fallback="Unknown" type="date" format="jS F Y"}}.

What I really need to achieve is that when there is no date the fallback clause of the above code is displayed. In the worst case, a bank value is displayed.
How can I do this, please?

Thanks,
Christopher

Hey Christopher,

Please try removing the format attribute in the DC as that could be the one outputting the default date. To format the ACF date, try using its Date Display Format in the ACF field setting.

Thanks.

Hi @christian,

Thanks for the help. Unfortunately removing the format attribute in the DC means that no date is rendering (see screenshots), even though ACF was already set up as you suggested in your screenshot. I have no idea why it only renders with the format attribute in place.

Thanks,
Christopher

Hey @whitemedia,

I tried that on my site, and it works. Please ensure you’re using the latest version of Pro then uninstall ACF Pro and install it again so that you get the latest provided version by Pro.

If it still won’t work and if you’re using a child theme, please deactivate the child theme and all 3rd party plugin to test for conflicts.

If it still won’t work after that, please keep the parent Pro theme activated with all 3rd party plugins deactivate and give us the follow details in a Secure Note

  • Page URL where we can see the issue
  • WordPress Login URL
  • Admin username and password

Thanks.

Hi @christian,

Thanks. I already had the latest version of ACF Pro. I played around with the ACF date output settings and it is now working properly.

Thank you for the help,
Christopher

You are most welcome.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.