WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

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'm working on a theme that requires the end-user to specify the current performance season using a custom admin panel I've created, ie. "2013/2014", "2014/2015" etc., which I can retrieve using get_option('current_season');

On my custom nav menu I have a page titled "Season" that needs the aforementioned field inserted into it so it reads "2013/2014 Season" rather than just "Season".

The walker tutorials I have looked at only seem to show examples of adding a class to menu items but I need to add specific text to one menu item. How can I achieve this?

share|improve this question
up vote 0 down vote accepted

You can try the wp_nav_menu_objects filter. This seems to work, but not sure what other side-effects it may have, you'll want to test thoroughly.

function wpa_filter_nav_menu_objects( $items ){
    foreach( $items as $item ){
        if( 'Season' == $item->title ){
            $item->title = get_option('current_season') . ' Season';
    return $items;
add_filter( 'wp_nav_menu_objects', 'wpa_filter_nav_menu_objects' );
share|improve this answer
I'm astonished at what a knowledge of wordpress filters can do for a person. This worked brilliantly, right out of the box. I appreciate the assist and I'll let you know if I find any side-effects. – JMac Jun 9 '13 at 19:00

Most of individual menu item markup generation happens in Walker_Nav_Menu->start_el()

The title is going through filter in this part of code:

$item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;

So the_title filter should allow you to modify it. However it is somewhat challenging to implement precisely and depends on your specifics how to target it, because WP uses same filter in get_the_title() function for titles in general.

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.