Make WordPress Core

Ticket #28135: 28135.2.diff

File 28135.2.diff, 553 bytes (added by michalzuber, 11 years ago)

Show what post type doesn't exist

  • src/wp-includes/post.php

    diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php
    index e74e256..54377c1 100644
    a b function wp_insert_post( $postarr, $wp_error = false ) { 
    30783078
    30793079        $postarr = wp_parse_args($postarr, $defaults);
    30803080
     3081        if( ! post_type_exists( $postarr['post_type'] ) ) {
     3082                return new WP_Error( 'invalid_post_type', sprintf( __( 'Post type "%s" does not exist.' ), $postarr['post_type'] ) );
     3083        }
     3084
    30813085        unset( $postarr[ 'filter' ] );
    30823086
    30833087        $postarr = sanitize_post($postarr, 'db');