Support » Developing with WordPress » Blank nav_menu $attr_title. How can I trace what’s causing it

  • There’s a single page on my website where none of the parent nav_menu item titles are being printed, and for the life of me I can’t figure out why.

    All the other pages on my site display them fine.

    I’ve tried manually error_loging every single nav_menu and Walker filter I could think of to narrow it down, but no matter how early I hook into it, the $item->attr_title is blank.

    I’m sure there’s a way I can use xdebug to figure out what’s triggering the change, but Im not exactly sure how.

    Any suggestions?

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You could add debugging data output statements right in the relevant core code. Just keep backups of the original files to restore to when you’re done. You don’t really need to error_log() output, echo or print_r() will suffice, then you can see the data right on the page, though you may need to use the source view, depending on your theme. It helps to output within <pre> tags. It’s a matter of preference more than right or wrong. To each their own.

    The point being you can check variable assignments every step of the way. The titles must be there initially. See for yourself where the menu items are first retrieved in wp_nav_menu(). They are a special post type with a certain taxonomy term assigned. Check again about halfway down. Then you will know if the disappearance is before or after that point. Check again about halfway through whichever section has the issue. Continue until you zero in on precisely where it happens.

    If it happens during an apply_filters() call, find out what callbacks are added to that filter in the global $wp_filter array and trace each callback until you zero in on the cause.

    Extremely tedious process, but it will eventually yield results.

Viewing 1 replies (of 1 total)
  • The topic ‘Blank nav_menu $attr_title. How can I trace what’s causing it’ is closed to new replies.