Make WordPress Core

Ticket #40580: 40580.patch

File 40580.patch, 852 bytes (added by ruud@…, 6 years ago)

added is_wp_error check

  • src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    474474                $data     = $this->prepare_item_for_response( $post, $request );
    475475                $response = rest_ensure_response( $data );
    476476
    477                 if ( is_post_type_viewable( get_post_type_object( $post->post_type ) ) ) {
     477                if ( ! is_wp_error( $response ) && is_post_type_viewable( get_post_type_object( $post->post_type ) ) ) {
    478478                        $response->link_header( 'alternate',  get_permalink( $post->ID ), array( 'type' => 'text/html' ) );
    479479                }
    480480