Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

Så här addar du rubriker i WordPress-menyn utan att länka till en page

Letar du efter ett sätt att lägga till rubriker i WordPress-menyn utan att lägga till en link?

Som standard kräver WordPress-menyn att varje menu item är länkat till en page eller en customize-länk. När du skapar en dropdown-meny kanske du dock vill add to en titel för undermenyer utan att länka den till en specifik page.

I den här artikeln visar vi hur du addar titlar till menyn i WordPress utan att länka till en page.

Add WordPress Menu items without links

Varför lägga till rubriker i menyn utan att länka till en page?

WordPress erbjuder flera alternativ för att customize din website så att du kan nå din målgrupp och erbjuda en exceptionell användarupplevelse.

För att ge användarna en smidig upplevelse måste din website i WordPress ha en välstrukturerad navigation menu. Det gör det enkelt för användarna att hitta content och olika pages på din site.

När du addar rubriker till menyer kräver WordPress som standard att varje meny har en länk till en page eller en customize-länk. Du kanske dock vill visa en menytitel eller ej länka till en page i vissa situationer.

Du kan till exempel ha en dropdown för kategorier där du vill att rubriken ska vara ”categories” för menyn men inte behöver add to en länk. När användare klickar på kategorier kommer det helt enkelt att öppna en undermeny i dropdown.

Med detta sagt, låt oss titta på hur du kan add to en rubrik till WordPress-menyn utan att länka till en page.

Lägga till rubrik i WordPress-menyn utan att länka till en page

Det första du behöver göra är att lägga till ett nytt menu item i din menu. Du kan göra det genom att gå till Appearance ” Menus från din WordPress adminpanel.

Därefter vill du lägga till en customize link. Du kan se alternativen för ”Custom Links” i section ”Add menu items”.

Om du inte ser Customize Links, klicka bara på knappen ”Screen Options” högst upp till höger på skärmen. Därefter kontrollerar du boxen för ”Custom Links”.

Screen options in WordPress

Efter det måste du enter en etikett eller rubrik för ditt menu-item.

I fältet URL går du vidare och enter hashtag (#) symbolen och klickar på knappen ”Add to Menu”.

Add a custom link menu item

Ditt menu item läggs nu till i WordPress-menyn.

Därefter måste du klicka på dropdown-pilen bredvid den här customize-länken för att editera menu-item. Gå vidare och ta bort hashtag-tecknet från URL-fältet och klicka på knappen ”Save Menu”.

Remove the hashtag sign and save menu

You can add sub menus to this menu item and link them to any page or enter a custom link if you want.

Om du nu går till din WordPress blogg, så kommer du att se ett menu-item utan en link.

Menu title preview without link

Vi hoppas att den här artikeln hjälpte dig att lära dig hur du lägger till rubriker i WordPress-menyn utan att länka till en page. Du kanske också vill kontrollera vår guide om hur du registrerar ett domain name och våra expertval för den bästa AI-chatbotprogramvaran för din website.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Avslöjande: Vårt innehåll stöds av våra läsare. Det innebär att om du klickar på några av våra länkar, kan vi tjäna en provision. Se hur WPBeginner finansieras, varför det är viktigt, och hur du kan stödja oss. Här är vår editoriala process.

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

Den ultimata WordPress-verktygslådan

Få GRATIS tillgång till vår verktygslåda - en samling WordPress-relaterade produkter och resurser som varje professionell användare bör ha!

Reader Interactions

107 kommentarerLämna ett svar

  1. Syed Balkhi

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Marit

    Thank you! This was exactly the information I needed!

  3. Ken

    Just what I needed.
    I was scratching my head wondering how I would be able to do this.
    Then I came across this article, thank you very much.

  4. Jon

    This worked great, thanks!

  5. Petur Kirke

    One small thing missing in this article.
    How to get rid of the hand (cursor: pointer), or is it only me, who have this problem ?

  6. Scot

    I’ve used this type of custom link in the top level of my primary menu, and it works great on the desktop. But on mobile devices, when I tap the custom link, it doesn’t open the sub menus below it, so none of those pages are available. Is there a way to fix that?

  7. adnan

    this was helpful thanks

  8. Hamba Allah

    thank you soo much :*

  9. Luis Casanova

    Thank you!
    Just what I needed!

  10. Steve

    I added a title to my web site menu as you suggested using the # method but needed to remove it. I did so on Dashboard but it still shows on my site main menu and when opened it says ”blank page” and that it is unsecure. How do it remove it.

    • WPBeginner Support

      If you are using a caching plugin then please delete cached files. Also visit Menus screen to make sure that you have deleted the menu item. Don’t forget to click on the save menu item after removing or adding an item to the menu. Hope this helps.

      Administratör

  11. Pam Hill

    I have an existing menu that I need to remove page links from. How do I do that? I have 3 titles in the header that link to its own page. I do not want it to link to any page.

  12. Danielle

    OMG this was a life saver and I’d wish I found this about 6 mos ago….I’ve been trying to figure this out for the longest time. THANK YOU SO MUCH!!

  13. Brendan Dunne

    I used this method to solve my problem and it works great thanks.

    However, the created menu header is not a page so when I go to map the sub pages, how do I structure them?

  14. Marek

    Hello,

    I created a custom menu item in which I want to function as a label only, so I deleted the URL from that item, but it still shows a different color on mouse-over as if it was a link. How do I disable that hover effect from that item?

    You can see it here: and the item is the ’Written About Braunstein’s:’ in the menu below the logo.

    Thanks

    • Susan Taunton

      This is in response to Marek’s August 9th question about how to remove the hover effect from a non-linked menu title:

      Marek,

      You can use the browser development tool to identify that title’s menu-item-number and then use css to define the link, visited, hover, focus, active colors to all be the same and so remove the hover effect.

      Example:
      #menu-item-2036 a,
      #menu-item-2036 a:link,
      #menu-item-2036 a:visited,
      #menu-item-2036 a:hover,
      #menu-item-2036 a:focus,
      #menu-item-2036 a:active {
      color:#C1A45B;
      }

      Susan

  15. Huzni Saud

    great work mate

  16. Penelope Whiteley

    I didn’t understand this … are there any more images that maybe show the finished product?

  17. Norbert

    Thanks, it is brilliant and works!!!!

  18. WILLIAM

    Thank you, it works like a charm.

  19. Rui

    Using Appearance>Menus,create a Custom Links item with the URL as

    javascript: void(0);

    This is the a great way of solving that problem :)

  20. Peter

    This has bugged my for a while but never did anything about it. Googled and bingo, sorted. So simple thank you.

  21. Annelisse Miller

    Worked Perfect! So easy to follow! Thank you!

  22. teri matelson

    can you make a custom link, added to the primary navigation, open in a new window?

  23. Matthias

    Thanks – really helpful!

  24. Rajit

    Hi, How do I modify the styling of custom links? I want to separate two sets of menu items with separate non-clickable headings.

    Thanks

  25. Graham

    Cheers for that. We were really stuck. Knew it could be done, but didn’t know how…until now. Yer a star :)

  26. Rosie

    Thank you!! This is exactly what I needed to do and it has worked a treat.
    Rosie

  27. Sanjay Nair

    So simple! Just what I needed. Thank you.

  28. Hayley

    Thank you! Exactly what I needed!

  29. Carol M. Smith

    Thanks … but I do not want the words ”Menu Item” to be in the menu … Can I change the name ”Menu Items” ?

  30. Leanne

    exactly what I needed to know! thank you!!

  31. Bob Varaleau

    I was using categories to do this but this is much better. There is one problem that you might be able to help me with.

    If a viewer was to click on the custom link the custom menu link will remain high lighted until you click on a sub item or some where else on the page. It is a minor thing but if it could be rectified it would make this fix for the menu even better. Is it possible to make this custom link menu button non-clickable using CSS??

  32. Menno van der Krift

    Cheers! Works like a charm.

  33. Mike

    Oddly this doesn’t work on the iPad. Before the submenu can appear, it asks if you want to save the image? Works perfectly well when the drop down button has a normal page link, i.e, the menu item is drawn from ’Pages’.

  34. George

    This is great – it works. However, the title of my drop-down menu has changed colour – from white to blue. Can anyone explain how I can correct this in wordpress?

  35. jhodgski

    Thanks for this, but wouldn’t it result in invalid HTML as I see you end up with an anchor/link element which has no href attribute. It would also be semantically incorrect to use and anchor/link element if the item isn’t actually a link. Is there a better way?

  36. viktoriana

    This didn’t work in my case :/ Have ”converted” a menu which was a ul list of links into a registered wp_nav_menu and now the categories which where listed as wp_list_categories do NOT appear under the custom link as they used to. Somehow wp_list_categories has to be added still into the wp_nav_menu , and it’s not at all that simple as this post suggests. :/

  37. viktoriana

    except this is not working :( followed exactly what you’ve written, added two categories us subpages, but submenu is not showing.
    there must be some wp_list_categories thingy messing up my wp_nav_menu …

  38. bb

    I love wpbeginner! Thanks for this tweak, cheers

  39. Rob Lowndes

    Just what I am looking for. But when I place some pages as sub items under the new blank menu item it looks great until I save the menu and then those pages autmatically revert to the main menu! In other words WP 3.7.1 is not allowing me to save any sub menus to the new item. Can someone help me?

  40. Wayne Gerald

    I did this on my extensive training website. However, I ran out of custom links, meaning I reached WordPress’s custom link limit. Going past this limit, the navigation menu no longer saves. So how do bypass this custom link limit? Is there a plugin? If so, I can’t find it.

    Any help would be much, much appreciated.

  41. kuldip

    Thanx dude it’s helpful for me

  42. Muhlis

    this is what i looking for to edit category dropdown menu in my website resellerhunter.com, thanks for helping.

  43. grrprep

    I want to do something reverse. I want to add pages but not let them appear in menus. I have around 20 pages and do not want 20 sub links in my menu. help is appreciated.

    • CHRIS

      Go to the menus and uncheck the ”Automatically add new top-level pages” Now if you want any page to appear at menu you will have to add by yourself.

  44. Janet

    Thank you! I’ve always wondered how to do this.:)

  45. Jake Tyler

    That’s some nice tut, really, thanks so much.

  46. Chris

    Is there any way when we left the mouse on that menu item who hasent got any link, not to change the mouse cursor? Practicaly the browser not to understand as a link?

    Thanks.

    • Mike Ott

      You could just target the element in CSS with:

      cursor:crosshair;

  47. Buck

    Nice tut, i never know this is possible.

  48. Beth Pittman

    Thank you for this post! Is it just me but does anyone else have trouble getting the drop down arrows on the menu screen to open up? When I click on the arrow, it simply moves the menu item down on the menu. I have to repeatedly do this until, finally, it will open. Any tips?

  49. Lorne

    How would accomplish (change) the same thing on a web site WP v3 with already existing Menus?

    Thanks

  50. SmittenbyBritain

    Thanks for the tip. I was trying to figure out how to do that. I just linked things back to home if I didn’t have a url. This works great!

  51. bob

    what if you have already established a large menu bar? can you go back and change the first menu bar title to not connect to a page?

    • Editorial Staff

      Yes, you can always adjust the menus. This technique is particularly helpful if you want to add dropdown items in your long menu bar.

      Administratör

Lämna ett svar

Tack för att du väljer att lämna en kommentar. Tänk på att alla kommentarer modereras enligt våra policy för kommentarer, och din e-postadress kommer INTE att publiceras. Vänligen använd INTE nyckelord i namnfältet. Låt oss ha en personlig och meningsfull konversation.