Customize: Prevent JS error in Links widget when selective refresh is enabled

This prevents erroneously replacing the `data-customize-partial-id` when only the `id` attribute should be replaced. 

Props dlh, costdev, nikeo, greenshady.
Fixes #39451.


git-svn-id: https://develop.svn.wordpress.org/trunk@54125 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2022-09-11 21:55:28 +00:00
parent db0290b042
commit 4b3476530d

View File

@ -48,7 +48,7 @@ class WP_Widget_Links extends WP_Widget {
$order = 'rating' === $orderby ? 'DESC' : 'ASC';
$limit = isset( $instance['limit'] ) ? $instance['limit'] : -1;
$before_widget = preg_replace( '/id="[^"]*"/', 'id="%id"', $args['before_widget'] );
$before_widget = preg_replace( '/ id="[^"]*"/', ' id="%id"', $args['before_widget'] );
$widget_links_args = array(
'title_before' => $args['before_title'],