Make WordPress Core

Ticket #55877: 55877.patch

File 55877.patch, 729 bytes (added by Chouby, 2 years ago)
  • src/wp-includes/post.php

    diff --git src/wp-includes/post.php src/wp-includes/post.php
    index 288704c66d..94006f7b38 100644
    function wp_insert_post( $postarr, $wp_error = false, $fire_after_hooks = true ) 
    41554155         */
    41564156        $post_type_object = get_post_type_object( $post_type );
    41574157
    4158         if ( ! $update && 'pending' === $post_status && ! current_user_can( $post_type_object->cap->publish_posts ) ) {
     4158        if ( ! $update && 'pending' === $post_status && ! empty( $post_type_object ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) {
    41594159                $post_name = '';
    41604160        } elseif ( $update && 'pending' === $post_status && ! current_user_can( 'publish_post', $post_ID ) ) {
    41614161                $post_name = '';