Support

Account

Home Forums ACF PRO ACF Date Field doesnt'work since WP 5.1.1

Solving

ACF Date Field doesnt'work since WP 5.1.1

  • Hello,

    I recently updated Wordpres to 5.1.1 version, and the date Fields don’t save / show any value in the wordpress backoffice.

    The date field is shown as a classic field text, with no date picker, and is always blank : the data previously save don’t appear in the field. Moreover, it doesn’t save the data if the fill the field.

    I am in the wordpress backoffice, in a post type that uses date fields.

    I use the Advanced Custom Fields PRO version 5.3.17

    I tried to update the plugin to the 5.7.13 version, but when I do that the backoffice doesnt’t work at all : I have a blank screen on every backoffice pages. So I went back to the 5.3.17 version.

    Do you know about this problem ?

    I see that the 5.3.17 ACF plugin is not compatible width wordpress 5.1.1…
    Which ACF version souhld I use ?

    Thank you very much,
    Benoît Landhauser
    bennyb35@gmail.com

  • I’m experiencing this same issue. Has anyone addressed this?

    The issue I am experiencing is changing the date in the date field on a post doesn’t save to the database. The original value remains. The date field simply won’t save and can’t be changed.

    User error on my end – ignore my post!

  • Hi,

    I was on my way to write a new post on the forum when I read this one. So I post here, hope this is relevant.

    The code below was working like a charm, and it doesn’t since last wp update (Wp 5.1.1) with ACF 5.7.13.

    Basically I call my custom post type ‘event’ twice. One time for the futur events, one time for the past event.

    Since WP update, the futur event doesn’t display.

    The initial code

    
    $today = date("Ymd");
    
    // Futur event (works before update)
    $nextevents_args = array(
        'post_type' 	=> 'event', 
        'post_status' 	=> 'publish',
        'meta_query'	=> array(
            array(
                "key" => "date",
                "value" => $today,
                "compare" => ">"
            )
        ),
        'posts_per_page' => -1,
        'orderby'  => 'meta_value_num',
        'meta_key' => 'date',
        'order'    => 'ASC',
    );
    $nextevents = new WP_Query( $nextevents_args );
    if ($nextevents->have_posts()):
        while ($nextevents->have_posts()) :
           $nextevents->the_post();
           the_title();
        endwhile; 
    endif;
    wp_reset_postdata(); 
    
    // Past events
    $oldevents_args = array(
        'post_type' 	=> 'event', 
        'post_status' 	=> 'publish',
        'meta_query'	=> array(
            array(
                "key" => "date",
                "value" => $today,
                "compare" => "<"
            )
        ),
        'posts_per_page' => -1,
        'orderby'  => 'meta_value_num',
        'meta_key' => 'date',
        'order'    => 'DESC',
    );
    $oldevents = new WP_Query($oldevents_args);
    if ($oldevents->have_posts() ):
       while ($oldevents->have_posts() ) :
            $oldevents->the_post();
            the_title();
       endwhile; 
    endif;
    wp_reset_postdata(); 

    In this example, the past events are displayed, the futur events are not.

    I’ve tested

    var_dump($today) // return '20190419'

    Where I’m loosing my hair :
    1) The two queries are exactly the same, only the “compare” argument is different.
    2) In the “futur event” query, if I replace

    
    "key" => "date",
    "value" => $today,
    "compare" => ">"
    

    by

    
    "key" => "date",
    "value" => '20190419',
    "compare" => ">"
    

    It works !!

    I also change the type of $today into ‘integrer’ but that doesn’t change anything. The futur event are still not showing.

    Hope someone can help,
    Thank you

    PS : sorry if I’m not on the right forum post.

  • Hi,

    I was on my way to write a new post on the forum when I read this one. So I post here, hope this is relevant.

    The code below was working like a charm, and it doesn’t since last wp update (Wp 5.1.1) with ACF 5.7.13.

    Basically I call my custom post type ‘event’ twice. One time for the futur events, one time for the past event.

    Since WP update, the futur event doesn’t display.

    The initial code

    
    $today = date("Ymd");
    
    // Futur event (works before update)
    $nextevents_args = array(
        'post_type' 	=> 'event', 
        'post_status' 	=> 'publish',
        'meta_query'	=> array(
            array(
                "key" => "date",
                "value" => $today,
                "compare" => ">"
            )
        ),
        'posts_per_page' => -1,
        'orderby'  => 'meta_value_num',
        'meta_key' => 'date',
        'order'    => 'ASC',
    );
    $nextevents = new WP_Query( $nextevents_args );
    if ($nextevents->have_posts()):
        while ($nextevents->have_posts()) :
           $nextevents->the_post();
           the_title();
        endwhile; 
    endif;
    wp_reset_postdata(); 
    
    // Past events
    $oldevents_args = array(
        'post_type' 	=> 'event', 
        'post_status' 	=> 'publish',
        'meta_query'	=> array(
            array(
                "key" => "date",
                "value" => $today,
                "compare" => "<"
            )
        ),
        'posts_per_page' => -1,
        'orderby'  => 'meta_value_num',
        'meta_key' => 'date',
        'order'    => 'DESC',
    );
    $oldevents = new WP_Query($oldevents_args);
    if ($oldevents->have_posts() ):
       while ($oldevents->have_posts() ) :
            $oldevents->the_post();
            the_title();
       endwhile; 
    endif;
    wp_reset_postdata(); 

    In this example, the past events are displayed, the futur events are not.

    I’ve tested

    var_dump($today) // return '20190419'

    Where I’m loosing my hair :
    1) The two queries are exactly the same, only the “compare” argument is different.
    2) In the “futur event” query, if I replace

    
    "key" => "date",
    "value" => $today,
    "compare" => ">"
    

    by

    
    "key" => "date",
    "value" => '20190419',
    "compare" => ">"
    

    It works !!

    Also :
    – I’ve set up a new event today (in wp 5.1.1 / acf 5.7.13), I check and the field date is saved into the DB
    – I change the type of $today into ‘integrer’ but that doesn’t change anything. The futur event are still not showing.

    Hope someone can help,
    Thank you

    PS : sorry if I’m not on the right forum post.

  • Hi again,

    I’ve tested something and it work : I re-save the group field under ACF menu and everything return to normal.

    My futur and past events are back.
    Hope this can help anyone.

  • I noticed this as well. Since my custom fields are set up via code in the theme, the solution was to change the label temporarily, re-load the edit page, then change the label back to the original, reload the edit page, make the changes, and save. Seems like some kind of cache needs a kick in the butt.

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

You must be logged in to reply to this topic.