Support

Account

Home Forums Backend Issues (wp-admin) Date Picker error in ACF field following WP update

Solving

Date Picker error in ACF field following WP update

  • Hi! I love ACF, does exactly what I want, thank you for building such a useful tool.

    I have discovered a very strange behavior in a date-picker custom field on a specific custom type of post on my site, that I hope you will find interesting and be able to help me fix.

    I currently maintain the site but much of the architecture was set up by a developer I hired — I have tried to identify a fix for the problem but my background is not in web development and I have been unsuccessful so far. Please allow me to explain:

    I have a site with a number of custom page types, one of them is “Publications” and another is “News”. Both types of posts have a different custom field (called slightly different things) that indicate a date. The field has the type Date Picker. This has historically worked great — the dropdown appears when you click on the field in wp-admin, people can select a date, awesome.

    Last week I upgraded the WordPress version from 4.9.12 to to 5.2.4. What has happened is that when adding a new “Publication” post, the date-picker custom field no longer has the dropdown. If I enter the date manually, the site complains that no entry has been given for this (required) custom field. Adding new custom fields to the Publications field group shows the same behavior. This field is not being used properly.

    What is strange is that News posts are still fine. They have a custom field that is a Date Picker as well, but this works like it always has. It would be one thing if Date Picker custom fields were screwed up across the whole site, but *they are only screwed up on Publication pages*. There must be something about Publication pages coupled with the upgrade to WordPress which makes the custom field not work.

    I was looking though the HTML for the two cases (“News” is working, “Publications” is not) and the only difference I can see is shown below:

    ————-

    WORKING:

    
      <div class="acf-input">
        <div class="acf-date-picker acf-input-wrap" data-date_format="MM d, yy" data-first_day="1">
          <input id="acf-field_5dc21556404ac" class="input-alt" name="acf[field_5dc21556404ac]" value="" type="hidden">
          <input class="input hasDatepicker" value="" type="text" id="dp1573000615811">
        </div>
      </div>
    

    NOT WORKING:

    
      <div class="acf-input">
        <div class="acf-date-picker acf-input-wrap" data-date_format="MM d, yy" data-first_day="1">
          <input id="acf-field_5a582ad0a20e5" class="input-alt" name="acf[field_5a582ad0a20e5]" value="" type="hidden">
          <input class="input" value="" type="text">
        </div>
      </div>
    

    ————-

    I generated these just by adding new Date Picker fields to the two groups — there’s no value that’s been entered yet but the top one gives the dropdown when you click on it while the bottom one doesn’t. The difference is clearly in the input tag that is given class “input hasDatepicker” vs the tag that is given class “input”. I was not able to find where or how ACF is inserting hasDatepicker into this tag or why it might be different for Publications posts as opposed to News posts.

    Thanks for your time, and look forward to your thoughts!

  • My datepickes shows wrong time (3 hours diffrence) after wp update.

  • I am having the same exact problem.
    Only one particular custom post type is not displaying the calendar.
    Any luck solving this?
    Thanks!

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Date Picker error in ACF field following WP update’ is closed to new replies.