Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WP_REST_Widget_Types_Controller::get_widget_preview( string $widget, array $instance ): string
Returns the output of WP_Widget::widget() when called with the provided instance. Used by encode_form_data() to preview a widget.
Parameters
-
$widget
string Required -
The widget's PHP class name (see class-wp-widget.php).
-
$instance
array Required -
Widget instance settings.
Return
string
Source
File: wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
.
View all references
private function get_widget_preview( $widget, $instance ) {
ob_start();
the_widget( $widget, $instance );
return ob_get_clean();
}
Changelog
Version | Description |
---|---|
5.8.0 | Introduced. |