WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a custom theme and the navigation part uses hashtags (yes, all content is on one page). So when i use

wp_nav_menu( array( 'theme_location' etc

the menu items links to the pages. Can i use/edit wp_nav_menu so it adds a # for every page link, like




Or should i create a custom menu function?

bonus question: Why doesn't wp_get_nav_menu_items give me the permalink/slug for post_name but just the post number as post_name? (see http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items)

share|improve this question
up vote 1 down vote accepted

You already hinted it yourself: When you look at wp_get_nav_menu_items() you'll see that the resulting Array of items gets mapped over with wp_setup_nav_menu_item() - in other words, this function gets applied to each and every nav menu item.

In there you can hook into the 'wp_setup_nav_menu_item'-filter with its $menu_item argument, or use one of the filters in the applied functions in between. The level of control just lays in what you use where (look up source). The argument itself is an object that you can influence.

share|improve this answer

Probably the easiest way to make menu items with hashtags is to use the Custom Links Box on the Menu Screen.

Custom links allow links defined by you that don't fit into the other types of menu items.

Regarding your second question, get the post_title if you want the name.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.