public function prepare_item_for_response( $item, $request ) {
$data = array();
$fields = $this->get_fields_for_response( $request );
if ( rest_is_field_included( 'id', $fields ) ) {
$data['id'] = (int) $item->ID;
}
$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 ( rest_is_field_included( '_links', $fields ) || rest_is_field_included( '_embedded', $fields ) ) {
$links = $this->prepare_links( $item );
$response->add_links( $links );
}
return $response;
}
/**
* Prepares the links for the request.
*
* @since 6.3.0
*
* @param WP_Post $post the Navigation Menu post object.
* @return array Links for the given request.
*/
private function prepare_links( $post ) {
return array(
'self' => array(
'href' => rest_url( rest_get_route_for_post( $post->ID ) ),
'embeddable' => true,
),
);
}
}
Fatal error: require_once(): Failed opening required '/var/www/html/revistacentral.com.br/web/wp-includes/blocks/search.php' (include_path='.:/usr/share/pear') in /var/www/html/revistacentral.com.br/web/wp-includes/blocks/require-dynamic-blocks.php on line 62
Fatal error: Uncaught Error: Call to a member function set() on null in /var/www/html/revistacentral.com.br/web/wp-includes/l10n.php:856
Stack trace:
#0 /var/www/html/revistacentral.com.br/web/wp-includes/l10n.php(959): load_textdomain('default', '/var/www/html/r...', 'pt_BR')
#1 /var/www/html/revistacentral.com.br/web/wp-includes/class-wp-fatal-error-handler.php(49): load_default_textdomain()
#2 [internal function]: WP_Fatal_Error_Handler->handle()
#3 {main}
thrown in /var/www/html/revistacentral.com.br/web/wp-includes/l10n.php on line 856