Widgets: Add a comment in WP_Nav_Menu_Widget::form() to clarify the esc_attr() usage.

The URL to create a new menu from the the Navigation Menu widget can be a `javascript:` link to the Customizer Menus panel, so `esc_attr()` is used here instead of `esc_url()`.

Follow-up to [53092].

Props hztyfoon.
Fixes #56128.
Built from https://develop.svn.wordpress.org/trunk@53630


git-svn-id: http://core.svn.wordpress.org/trunk@53189 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-07-01 20:01:15 +00:00
parent c3188a2566
commit 1f87125366
2 changed files with 7 additions and 3 deletions

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.1-alpha-53629';
$wp_version = '6.1-alpha-53630';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.

View File

@ -171,8 +171,12 @@ class WP_Nav_Menu_Widget extends WP_Widget {
$url = admin_url( 'nav-menus.php' );
}
/* translators: %s: URL to create a new menu. */
printf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_attr( $url ) );
printf(
/* translators: %s: URL to create a new menu. */
__( 'No menus have been created yet. <a href="%s">Create some</a>.' ),
// The URL can be a `javascript:` link, so esc_attr() is used here instead of esc_url().
esc_attr( $url )
);
?>
</p>
<div class="nav-menu-widget-form-controls" <?php echo $empty_menus_style; ?>>