{"id":1792,"date":"2024-12-17T10:47:10","date_gmt":"2024-12-17T09:47:10","guid":{"rendered":"https:\/\/wpmastertoolkit.com\/module\/autoriser-louverture-des-liens-personnalises-du-menu-dans-un-nouvel-onglet\/"},"modified":"2024-12-31T18:24:49","modified_gmt":"2024-12-31T17:24:49","slug":"autoriser-louverture-des-liens-personnalises-du-menu-dans-un-nouvel-onglet","status":"publish","type":"module","link":"https:\/\/wpmastertoolkit.com\/en\/module\/allow-custom-menu-links-to-open-in-a-new-tab\/","title":{"rendered":"Allow custom menu links to open in a new tab"},"content":{"rendered":"<h1 class=\"wp-block-heading\">Add a link in a new tab with the \"Custom Link Menu New Tab\" module<\/h1>\n\n\n\n<p class=\"wp-block-paragraph\">In a WordPress site, it often happens that certain links in the navigation menu need to open in a new tab. However, WordPress doesn't offer a simple, visible interface for managing this behavior directly from the menu settings. That's why we've developed the <strong>Custom Link Menu New Tab<\/strong> from WPMasterToolKit. This module adds a practical option for configuring the opening of custom links in a new tab, while automatically adding attributes such as <code data-no-auto-translation=\"\">rel=\"noopener noreferrer nofollow\"<\/code>This enhances both the user experience and safety.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Which plugin can the \"Custom Link Menu New Tab\" module replace?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">This module can easily replace dedicated plugins such as <strong>\"External Links in New Window \/ New Tab<\/strong> or other similar extensions that add functionality for opening links in a new tab for menus.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Simplified management of personalized links<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">With the <strong>Custom Link Menu New Tab<\/strong>users now have precise control over the opening of custom links in menus. Here's how it works:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Checkbox added to menu parameters<\/strong> A new checkbox appears in the menu item editing options (only available for custom links).<\/li>\n\n\n\n<li><strong>Save selected option<\/strong> If this option is enabled, it will be saved for this specific menu link.<\/li>\n\n\n\n<li><strong>Automatic addition of attributes<\/strong> When the box is checked, the attributes <code data-no-auto-translation=\"\">target=\"_blank\"<\/code> and <code data-no-auto-translation=\"\">rel=\"noopener noreferrer nofollow\"<\/code> are automatically added to the link, guaranteeing greater security and SEO compliance.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">How do I use the \"Custom Link Menu New Tab\" module?<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Activate the <strong>Custom Link Menu New Tab<\/strong> from the WPMasterToolKit parameters.<\/li>\n\n\n\n<li>Go to <strong>Appearance &gt; Menus<\/strong> in the WordPress dashboard.<\/li>\n\n\n\n<li>Add or modify a <strong>personalized link<\/strong> in your menu.<\/li>\n\n\n\n<li>In the element parameters, a new checkbox entitled <strong>\"Open link in new tab and add rel='noopener noreferrer nofollow' \"<\/strong> will appear. Check it if you want the link to open in a new tab.<\/li>\n\n\n\n<li>Save the menu to apply the changes.<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img alt=\"WordPress menu management interface\" fetchpriority=\"high\" decoding=\"async\" width=\"917\" height=\"610\" src=\"https:\/\/wpmastertoolkit.com\/wp-content\/uploads\/2024\/12\/image-29.png\" class=\"wp-image-2906\" srcset=\"https:\/\/wpmastertoolkit.com\/wp-content\/uploads\/2024\/12\/image-29.png 917w, https:\/\/wpmastertoolkit.com\/wp-content\/uploads\/2024\/12\/image-29-300x200.png 300w, https:\/\/wpmastertoolkit.com\/wp-content\/uploads\/2024\/12\/image-29-768x511.png 768w\" sizes=\"(max-width: 917px) 100vw, 917px\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">The module does all the work in the background: it saves your choice and automatically applies the necessary attributes.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Technical choices behind the module<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Optimized performance<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In keeping with the WPMasterToolKit philosophy, we've designed this module so that it doesn't load <strong>no unnecessary resources<\/strong>. If the module is not activated, it is not loaded into WordPress, which limits its impact on your site's overall performance.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Using WordPress filters and actions<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">We used <strong>native WordPress hooks<\/strong> to ensure maximum compatibility with other extensions and themes:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code data-no-auto-translation=\"\">wp_nav_menu_item_custom_fields<\/code><\/strong> This filter allows us to add the checkbox directly to the menu item parameters.<\/li>\n\n\n\n<li><strong><code data-no-auto-translation=\"\">wp_update_nav_menu_item<\/code><\/strong> This action saves the value of the checkbox when the menu is saved.<\/li>\n\n\n\n<li><strong><code data-no-auto-translation=\"\">nav_menu_link_attributes<\/code><\/strong> This filter is used to automatically add the attributes <code data-no-auto-translation=\"\">target=\"_blank\"<\/code> and <code data-no-auto-translation=\"\">rel=\"noopener noreferrer nofollow\"<\/code> to the relevant custom links.<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">Enhanced safety<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Attributes <code data-no-auto-translation=\"\">rel=\"noopener noreferrer nofollow\"<\/code> automatically added protect your site from potential vulnerabilities linked to external links opened in a new tab, while respecting SEO best practices.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The module <strong>Custom Link Menu New Tab<\/strong> is a simple yet powerful solution for managing links in WordPress menus. Whether you're looking to enhance the user experience or strengthen your site's security and SEO, this module is designed to meet your needs while being lightweight and easy to use. By activating this module via WPMasterToolKit, you can say goodbye to additional plugins while retaining total control over your menus.<\/p>","protected":false},"excerpt":{"rendered":"<p>WPMasterToolKit's Custom Link Menu New Tab module simplifies the management of custom links in WordPress menus by adding an option to open links in a new tab. Easy to use, it automatically applies target=\"_blank \" and rel=\"noopener noreferrer nofollow \" attributes to improve security and SEO. A lightweight, high-performance solution that effectively replaces additional plugins dedicated to this task.<\/p>","protected":false},"featured_media":0,"parent":0,"template":"","meta":{"_acf_changed":true,"_seopress_titles_title":"Simplifiez les liens WordPress avec Custom Link Menu","_seopress_titles_desc":"Optimisez vos menus WordPress en ouvrant facilement des liens dans un nouvel onglet et boostez la s\u00e9curit\u00e9 avec WPMasterToolKit. D\u00e9couvrez comment\u00a0!","_seopress_robots_index":"","_seopress_robots_follow":"","_seopress_robots_imageindex":"","_seopress_robots_snippet":"","_seopress_robots_primary_cat":"","_seopress_robots_breadcrumbs":"","_seopress_robots_freeze_modified_date":"","_seopress_robots_custom_modified_date":"","_seopress_robots_canonical":"","_seopress_social_fb_title":"","_seopress_social_fb_desc":"","_seopress_social_fb_img":"","_seopress_social_fb_img_attachment_id":0,"_seopress_social_fb_img_width":0,"_seopress_social_fb_img_height":0,"_seopress_social_twitter_title":"","_seopress_social_twitter_desc":"","_seopress_social_twitter_img":"","_seopress_social_twitter_img_attachment_id":0,"_seopress_social_twitter_img_width":0,"_seopress_social_twitter_img_height":0,"_seopress_redirections_value":"","_seopress_redirections_enabled":"","_seopress_redirections_enabled_regex":"","_seopress_redirections_logged_status":"both","_seopress_redirections_param":"","_seopress_redirections_type":301,"_seopress_analysis_target_kw":"","_surecart_dashboard_logo_width":"180px","_surecart_dashboard_show_logo":true,"_surecart_dashboard_navigation_orders":true,"_surecart_dashboard_navigation_invoices":true,"_surecart_dashboard_navigation_subscriptions":true,"_surecart_dashboard_navigation_downloads":true,"_surecart_dashboard_navigation_billing":true,"_surecart_dashboard_navigation_account":true},"class_list":["post-1792","module","type-module","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/module\/1792","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/module"}],"about":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/types\/module"}],"wp:attachment":[{"href":"https:\/\/wpmastertoolkit.com\/en\/wp-json\/wp\/v2\/media?parent=1792"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}