[wp-trac] [WordPress Trac] #13273: Allow "'non-clickable" menu items

WordPress Trac noreply at wordpress.org
Thu Apr 10 04:48:35 UTC 2025


#13273: Allow "'non-clickable" menu items
--------------------------+--------------------------------
 Reporter:  stgoos        |       Owner:  (none)
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  6.9
Component:  Menus         |     Version:  3.0
 Severity:  normal        |  Resolution:
 Keywords:  needs-design  |     Focuses:  ui, accessibility
--------------------------+--------------------------------

Comment (by sonaliprajapati):

 Menus:

 Go to Appearance > Menus

 In the left panel, click Custom Links

 In the URL field, enter # (just a hash)

 In the Link Text field, enter the menu title (e.g., Links)


 Click Add to Menu

 Expand the menu item and remove the # if desired, or leave it — but you
 may also:

 Optional enhancement with jQuery:
 method :1
 =========
 jQuery(function($){
   $('a[href="#"]').on('click', function(e){
     e.preventDefault();
   });
 });
  Method :2
 .menu-item a[href="#"] {
   pointer-events: none;
   cursor: default;
 }

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/13273#comment:26>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list