diff --git src/wp-admin/edit-form-advanced.php src/wp-admin/edit-form-advanced.php
index 852b88c..a877c30 100644
|
|
|
$messages['post'] = array(
|
| 145 | 145 | 8 => __( 'Post submitted.' ) . $preview_post_link_html, |
| 146 | 146 | 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html, |
| 147 | 147 | 10 => __( 'Post draft updated.' ) . $preview_post_link_html, |
| | 148 | 11 => __( 'You attempted to publish an empty post. Provide some content before saving.' ), |
| 148 | 149 | ); |
| 149 | 150 | $messages['page'] = array( |
| 150 | 151 | 0 => '', // Unused. Messages start at index 1. |
| … |
… |
$messages['page'] = array(
|
| 159 | 160 | 8 => __( 'Page submitted.' ) . $preview_page_link_html, |
| 160 | 161 | 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html, |
| 161 | 162 | 10 => __( 'Page draft updated.' ) . $preview_page_link_html, |
| | 163 | 11 => __( 'You attempted to publish an empty page. Provide some content before saving.' ), |
| 162 | 164 | ); |
| 163 | 165 | $messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now. |
| 164 | 166 | |
| … |
… |
if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create
|
| 489 | 491 | <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div> |
| 490 | 492 | <?php endif; ?> |
| 491 | 493 | <?php if ( $message ) : ?> |
| 492 | | <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div> |
| | 494 | <div id="message" class="notice <?php echo ( isset( $_GET['error'] ) && '1' === $_GET['error'] ) ? 'notice-error' : 'updated notice-success'; ?> is-dismissible"><p><?php echo $message; ?></p></div> |
| 493 | 495 | <?php endif; ?> |
| 494 | 496 | <div id="lost-connection-notice" class="error hidden"> |
| 495 | 497 | <p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you’re reconnected.' ); ?> |
diff --git src/wp-admin/includes/post.php src/wp-admin/includes/post.php
index 1054f2b..87c612c 100644
|
|
|
function wp_autosave( $post_data ) {
|
| 1815 | 1815 | function redirect_post($post_id = '') { |
| 1816 | 1816 | if ( isset($_POST['save']) || isset($_POST['publish']) ) { |
| 1817 | 1817 | $status = get_post_status( $post_id ); |
| 1818 | | |
| | 1818 | $error = false; |
| 1819 | 1819 | if ( isset( $_POST['publish'] ) ) { |
| 1820 | 1820 | switch ( $status ) { |
| 1821 | 1821 | case 'pending': |
| … |
… |
function redirect_post($post_id = '') {
|
| 1824 | 1824 | case 'future': |
| 1825 | 1825 | $message = 9; |
| 1826 | 1826 | break; |
| | 1827 | case 'auto-draft': |
| | 1828 | case 'draft': |
| | 1829 | $message = 11; |
| | 1830 | $error = true; |
| | 1831 | break; |
| 1827 | 1832 | default: |
| 1828 | 1833 | $message = 6; |
| 1829 | 1834 | } |
| … |
… |
function redirect_post($post_id = '') {
|
| 1831 | 1836 | $message = 'draft' == $status ? 10 : 1; |
| 1832 | 1837 | } |
| 1833 | 1838 | |
| 1834 | | $location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) ); |
| | 1839 | $location = add_query_arg( array( 'error' => $error, 'message' => $message ), get_edit_post_link( $post_id, 'url' ) ); |
| 1835 | 1840 | } elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) { |
| 1836 | 1841 | $location = add_query_arg( 'message', 2, wp_get_referer() ); |
| 1837 | 1842 | $location = explode('#', $location); |
diff --git src/wp-includes/post.php src/wp-includes/post.php
index d879491..4bc06c1 100644
|
|
|
function wp_insert_post( $postarr, $wp_error = false ) {
|
| 3032 | 3032 | $post_name = $post_before->post_name; |
| 3033 | 3033 | } |
| 3034 | 3034 | |
| | 3035 | $post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status']; |
| | 3036 | if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash', 'auto-draft' ), true ) ) { |
| | 3037 | $post_status = 'inherit'; |
| | 3038 | } |
| | 3039 | |
| 3035 | 3040 | $maybe_empty = 'attachment' !== $post_type |
| 3036 | 3041 | && ! $post_content && ! $post_title && ! $post_excerpt |
| 3037 | 3042 | && post_type_supports( $post_type, 'editor' ) |
| 3038 | 3043 | && post_type_supports( $post_type, 'title' ) |
| 3039 | | && post_type_supports( $post_type, 'excerpt' ); |
| | 3044 | && post_type_supports( $post_type, 'excerpt' ) |
| | 3045 | && ( 'draft' !== $post_status && isset( $_POST['publish'] ) ); |
| 3040 | 3046 | |
| 3041 | 3047 | /** |
| 3042 | 3048 | * Filters whether the post should be considered "empty". |
| … |
… |
function wp_insert_post( $postarr, $wp_error = false ) {
|
| 3062 | 3068 | } |
| 3063 | 3069 | } |
| 3064 | 3070 | |
| 3065 | | $post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status']; |
| 3066 | | if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash', 'auto-draft' ), true ) ) { |
| 3067 | | $post_status = 'inherit'; |
| 3068 | | } |
| 3069 | | |
| 3070 | 3071 | if ( ! empty( $postarr['post_category'] ) ) { |
| 3071 | 3072 | // Filter out empty terms. |
| 3072 | 3073 | $post_category = array_filter( $postarr['post_category'] ); |