• The select field is not updating correctly. I’ve used the same act field on a custom post and it works fine. But a menu item, it always saves the first option, regardless of which option is selected.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have the same problem.

    I checked the $_POST in acf_location_nav_menu_save_post() in fields_actions.php and it only prints one value so maby WP is removing them from $_POST before your function is called?

    I Think i found some thing.

    This is what is posted to WP:

      {  
          "name":"acf[35][field_58be7320d7192][]",
          "value":"theme_teaser_color_gray"
       },
       {  
          "name":"acf[35][field_58be7320d7192][]",
          "value":"theme_teaser_color_beige"
       },
       {  
          "name":"acf[35][field_58be7320d7192][]",
          "value":"theme_teaser_color_green"
       },

    When I’m dumping $_POST[‘acf’] in fields_actions.php – acf_location_nav_menu_save_post()

    array (size=14)
      35 => 
        array (size=3)
          'field_58be720bba9d7' => string 'theme_teaser' (length=12)
          'field_58be72f4d7191' => string '12' (length=2)
          'field_58be7320d7192' => 
            array (size=1)
              '' => string 'theme_teaser_color_green' (length=24)

    When dumping $_REQUEST[‘acf’] in fields_actions.php – acf_location_nav_menu_save_post():

    array (size=14)
      35 => 
        array (size=3)
          'field_58be720bba9d7' => string 'theme_teaser' (length=12)
          'field_58be72f4d7191' => string '12' (length=2)
          'field_58be7320d7192' => 
            array (size=5)
              0 => string 'theme_teaser_color_red' (length=22)
              1 => string 'theme_teaser_color_white' (length=24)
              2 => string 'theme_teaser_color_gray' (length=23)
              3 => string 'theme_teaser_color_gray_dark' (length=28)
              4 => string 'theme_teaser_color_black' (length=24)

    ———–

    It works if i change line 37 from
    if( empty($_POST['acf']) )
    to
    if( empty($_REQUEST['acf']) )

    And changing line 45 from:
    foreach( $_POST['acf'] as $item_id => $item_fields )
    to
    foreach( $_REQUEST['acf'] as $item_id => $item_fields )

    Also having the same issue. Does this solution 100% work?

    Thanks in advance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Select Field Not Updating’ is closed to new replies.