Support

Account

Home Forums Backend Issues (wp-admin) Unable to add fields/existing fields disappeared Reply To: Unable to add fields/existing fields disappeared

  • The problem is that your filter runs on all post types. ACF field groups work just like any other post type and ACF uses itself to save the fields the same way that it saves values for our custom fields.

    At any rate, what you need to do is make sure you’re only doing this on the post types you need it to happen on.

    
    add_action('save_post', 'change_default_slug');
    
    function change_default_slug($post_id) {
    
    if (get_post_type($post_id) != 'your-post-type') {
      return;
    }
    
    //Check it's not an auto save routine
    if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) 
    return;