prepare_excerpt_response example

$data['content'] = array(
                'raw'      => $post->post_content,
                /** This filter is documented in wp-includes/post-template.php */
                'rendered' => apply_filters( 'the_content', $post->post_content ),
            );
        }

        if ( in_array( 'excerpt', $fields, true ) ) {
            $data['excerpt'] = array(
                'raw'      => $post->post_excerpt,
                'rendered' => $this->prepare_excerpt_response( $post->post_excerpt, $post ),
            );
        }

        $context  = ! empty( $request['context'] ) ? $request['context'] : 'view';
        $data     = $this->add_additional_fields_to_object( $data$request );
        $data     = $this->filter_response_by_context( $data$context );
        $response = rest_ensure_response( $data );

        if ( ! empty( $data['parent'] ) ) {
            $response->add_link( 'parent', rest_url( rest_get_route_for_post( $data['parent'] ) ) );
        }

        
Home | Imprint | This part of the site doesn't use cookies.