WordPress.org

Make WordPress Core

Ticket #6083: autosave-default-category.diff

File autosave-default-category.diff, 610 bytes (added by nbachiyski, 6 years ago)
  • wp-admin/admin-ajax.php

     
    473473        global $current_user; 
    474474 
    475475        $_POST['post_status'] = 'draft'; 
    476         $_POST['post_category'] = explode(",", $_POST['catslist']); 
     476        $_POST['post_category'] = explode(",", $_POST['catslist']? $_POST['catslist'] : get_option('default_category')); 
    477477        $_POST['tags_input'] = explode(",", $_POST['tags_input']); 
    478478        if($_POST['post_type'] == 'page' || empty($_POST['post_category'])) 
    479479                unset($_POST['post_category']);