mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Widgets: Validate HTML before saving block widgets.
Props talldanwp, noisysocks, kevin940726, peterwilsoncc. git-svn-id: https://develop.svn.wordpress.org/trunk@51414 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -178,8 +178,13 @@ class WP_Widget_Block extends WP_Widget {
|
||||
* @return array Settings to save or bool false to cancel saving.
|
||||
*/
|
||||
public function update( $new_instance, $old_instance ) {
|
||||
$instance = array_merge( $this->default_instance, $old_instance );
|
||||
$instance['content'] = $new_instance['content'];
|
||||
$instance = array_merge( $this->default_instance, $old_instance );
|
||||
|
||||
if ( current_user_can( 'unfiltered_html' ) ) {
|
||||
$instance['content'] = $new_instance['content'];
|
||||
} else {
|
||||
$instance['content'] = wp_kses_post( $new_instance['content'] );
|
||||
}
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user