Forums

[resolved] wp_nav_menu bug where title begins with number? (5 posts)

  1. cburtbcit
    Member
    Posted 8 months ago #

    Greetings,

    I've been working on a widget which displays the custom menu who's title matches that of the current page. One of the pages on the site I'm working on begins with a number, and so therefore the custom menu title begins with a number. When wp_nav_menu is called with this title as the 'menu' argument, wp_nav_menu fails to return the correct menu.

    I've attempted to track this down to wp_get_nav_menu_object and get_term_by in nav-menu.php and taxonomy.php respectively, but I can't see anything wrong with the code which would be ignoring the titles that begin with a number. I've even tested the SQL query presented in the code and it appears to find the term without difficulty.

    Is this a bug with the wp_nav_menu function? Thanks!

  2. cburtbcit
    Member
    Posted 8 months ago #

    I've been working on a widget which displays the custom menu who's title matches that of the current page. One of the pages on the site I'm working on begins with a number, and so therefore the custom menu title begins with a number.

    I should provide an example:

    Page Title: 1-A Lorem Ipsum
    Custom Menu Title: 1-A Lorem Ipsum

    This pulls up the first menu in the custom menu list.

    Page Title: One-A Lorem Ipsum
    Custom Menu Title: One-A Lorem Ipsum

    This pulls up the correct menu.

  3. esmi
    Theme Diva & Forum Moderator
    Posted 8 months ago #

    If you can verify this issue using Twenty Eleven with no other plugins active, you could try posting it in Trac.

  4. cburtbcit
    Member
    Posted 8 months ago #

    I'm going to put together a testing environment separate from the one in which this appears to be happening to test it more thoroughly. I've actually chased this down to wp_get_nav_menu_object() which, for some reason, is being passed a menu title which has the term_id stapled onto the end of it. I have no idea where it's coming from. More later.

  5. cburtbcit
    Member
    Posted 8 months ago #

    It appears as though this bug is already documented in Trac with a solution. And it appears as though it's going to be fixed in WordPress 3.3! Great news.

Reply

You must log in to post.

About this Topic