WordPress Menu Tool Show ID

by wordpress expert seth on February 17, 2011

I’m working on a custom WordPress theme for a great organization – California Adolescent health Collaborative and I’m running in to a real pain. I’m using the built in navigation tool in WordPress – a nice new feature since the 3.0 release (I think). Too many of my pages and categories have the same name, making it nearly impossible to build the menus. What I’d really like to see is the ID.  In comes some quick custom code. If I were smarter, I’m sure I could make this a plugin that didn’t alter core code, and maybe someone can take what I’ve done to the next level – but right now I need something quick and dirty- a hack. Here it is

Open wp-includes/nav-menu.php and find and replace:

$output .= empty( $item->label ) ? esc_html( $item->title ) : esc_html( $item->label );

with

$output .= empty( $item->label ) ? esc_html( $item->title ).” – ” .$item->ID : esc_html( $item->label ).” – ” .$item->ID;

Any viola – now I can tell the difference. I hope this helps. If it does or you see a better way – please leave a comment.

Leave a Comment

Previous post:

Next post: