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:
@@ -162,7 +162,7 @@ function next_widget_id_number( $id_base ) {
|
||||
$number = 1;
|
||||
|
||||
foreach ( $wp_registered_widgets as $widget_id => $widget ) {
|
||||
if ( preg_match( '/' . $id_base . '-([0-9]+)$/', $widget_id, $matches ) ) {
|
||||
if ( preg_match( '/' . preg_quote( $id_base, '/' ) . '-([0-9]+)$/', $widget_id, $matches ) ) {
|
||||
$number = max( $number, $matches[1] );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user