diff --git a/wp-includes/post.php b/wp-includes/post.php
index 5ef96b3..4b9c776 100644
a
|
b
|
function wp_insert_post( $postarr, $wp_error = false ) { |
2963 | 2963 | if ( !empty($page_template) && 'page' == $data['post_type'] ) { |
2964 | 2964 | $post->page_template = $page_template; |
2965 | 2965 | $page_templates = wp_get_theme()->get_page_templates(); |
2966 | | if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) { |
2967 | | if ( $wp_error ) |
2968 | | return new WP_Error('invalid_page_template', __('The page template is invalid.')); |
2969 | | else |
2970 | | return 0; |
2971 | | } |
2972 | | update_post_meta($post_ID, '_wp_page_template', $page_template); |
| 2966 | if ( count( $page_templates ) ) { |
| 2967 | if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) { |
| 2968 | if ( $wp_error ) |
| 2969 | return new WP_Error('invalid_page_template', __('The page template is invalid.')); |
| 2970 | else |
| 2971 | return 0; |
| 2972 | } |
| 2973 | update_post_meta($post_ID, '_wp_page_template', $page_template); |
| 2974 | } |
2973 | 2975 | } |
2974 | 2976 | |
2975 | 2977 | wp_transition_post_status($data['post_status'], $previous_status, $post); |