cp_restore_default_media_widget_schema( $instance, $new_instance, $old_instance, $widget )
Restores the default widget status and schema after removing am audio or video file.
Return
(array) $defaults Default widget schema
Source
File: wp-includes/widgets/class-wp-widget-media.php
function cp_restore_default_media_widget_schema( $instance, $new_instance, $old_instance, $widget ) {
if ( isset( $_POST['reset_widget'] ) && $_POST['reset_widget'] === '1' ) {
# Get the default schema for the widget
$schema = $widget->get_instance_schema();
$defaults = array();
foreach ( $schema as $key => $data ) {
$defaults[ $key ] = isset( $data['default'] ) ? $data['default'] : '';
}
return $defaults;
}
return $instance;
}
Changelog
| Version | Description |
|---|---|
| CP-2.5.0 | Introduced. CP-2.5.0 |