Make WordPress Core

Ticket #17115: 17115.5.diff

File 17115.5.diff, 1.1 KB (added by GhostToast, 9 years ago)

More careful check of $maybe_empty

  • src/wp-includes/post.php

     
    30773077                $post_name = $post_before->post_name;
    30783078        }
    30793079
    3080         $maybe_empty = 'attachment' !== $post_type
    3081                 && ! $post_content && ! $post_title && ! $post_excerpt
    3082                 && post_type_supports( $post_type, 'editor' )
    3083                 && post_type_supports( $post_type, 'title' )
    3084                 && post_type_supports( $post_type, 'excerpt' );
     3080        if ( 'attachment' === $post_type ) {
     3081                $maybe_empty = false;
     3082        } else {
     3083                $supports = 0;
     3084                if ( post_type_supports( $post_type, 'editor') ) {
     3085                        $supports ++;
     3086                        if ( empty( $post_content ) ) {
     3087                                $supports --;
     3088                        }
     3089                }
     3090                if ( post_type_supports( $post_type, 'title' ) ) {
     3091                        $supports ++;
     3092                        if ( empty( $post_title ) ) {
     3093                                $supports --;
     3094                        }
     3095                }
     3096                if ( post_type_supports( $post_type, 'excerpt' ) ) {
     3097                        $supports ++;
     3098                        if ( empty( $post_excerpt ) ) {
     3099                                $supports --;
     3100                        }
     3101                }
     3102                if ( $supports < 1 ) {
     3103                        $maybe_empty = true;
     3104                }
     3105        }
    30853106
    30863107        /**
    30873108         * Filter whether the post should be considered "empty".