mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Widgets: Make sure WP_Widget constructor creates a correct classname value for a namespaced widget class.
This reverts the changes to `id_base` from [50953] due to backward compatibility concerns, and instead focuses on the `id` and `class` attributes specifically. With this change, any backslashes in the `id` or `class` attributes for a namespaced widget class are converted to underscores, making it easier to style the output or target the widget with JavaScript. Follow-up to [50953]. Fixes #44098. git-svn-id: https://develop.svn.wordpress.org/trunk@50961 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -753,8 +753,13 @@ function dynamic_sidebar( $index = 1 ) {
|
||||
$classname_ .= '_' . get_class( $cn );
|
||||
}
|
||||
}
|
||||
$classname_ = ltrim( $classname_, '_' );
|
||||
$params[0]['before_widget'] = sprintf( $params[0]['before_widget'], $id, $classname_ );
|
||||
$classname_ = ltrim( $classname_, '_' );
|
||||
|
||||
$params[0]['before_widget'] = sprintf(
|
||||
$params[0]['before_widget'],
|
||||
str_replace( '\\', '_', $id ),
|
||||
$classname_
|
||||
);
|
||||
|
||||
/**
|
||||
* Filters the parameters passed to a widget's display callback.
|
||||
|
||||
Reference in New Issue
Block a user