Support

Account

Home Forums Backend Issues (wp-admin) Default Values not saving

Unread

Default Values not saving

  • I’m using the following code to pre-populate the default values of a Link field:

    add_filter('acf/load_field/key=field_681bd616fc827', function ($field) {
      if(!is_admin()){
        return $field;
      }
    
      if (get_post_type() === 'webinar' && !isset($_GET['post'])) {
        $field['default_value'] = array(
          'title' => 'Register',
          'url' => '#webinar-signup',
          'target' => '_self',
        );
      }
      return $field;
    });

    In the editor, it shows these values are populated, but when I save as draft OR publish, those default values are not being saved. Returning to edit the post shows the field as empty.

    Any ideas?

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.