wp_render_widget_control() WordPress Function
The wp_render_widget_control() function is used to render the HTML for a given widget control. This function is typically called by the dynamic_sidebar() function when a widget is being displayed in the admin panel. The wp_render_widget_control() function accepts two parameters: the id of the widget control to render, and an array of options for the widget control. The array of options must at least include the 'type' option, which specifies the type of widget control to render. Other options that may be included in the array are 'title', 'description', and 'width'. The wp_render_widget_control() function returns the HTML for the given widget control.
wp_render_widget_control( string $id ) #
Calls the control callback of a widget and returns the output.
Parameters
- $id
(string)(Required)Widget ID.
Return
(string|null)
Source
File: wp-includes/widgets.php
function wp_render_widget_control( $id ) { global $wp_registered_widget_controls; if ( ! isset( $wp_registered_widget_controls[ $id ]['callback'] ) ) { return null; } $callback = $wp_registered_widget_controls[ $id ]['callback']; $params = $wp_registered_widget_controls[ $id ]['params']; ob_start(); if ( is_callable( $callback ) ) { call_user_func_array( $callback, $params ); } return ob_get_clean(); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.8.0 | Introduced. |