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.

git-svn-id: https://develop.svn.wordpress.org/trunk@53630 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-07-01 19:59:38 +00:00
parent 8622af27bb
commit 2a10fc1e5b

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; ?>>