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

As a custom menu item wp doesn't add the class current_page_item

All other links it does?

<ul class="nav" id="menu-mainmenu"><li class="menu-item menu-item-type-custom menu-item-home menu-item-21152" id="menu-item-21152"><a href="http://mydomain/">Home</a></li>
<li class="menu-item menu-item-type-post_type current-menu-item page_item page-item-21154 current_page_item menu-item-21156" id="menu-item-21156"><a href="http://mydomain/">Future TV Guide</a></li>
<li class="menu-item menu-item-type-post_type menu-item-21153" id="menu-item-21153"><a href="http://mydomain/">About</a></li>

I would like to show it as an active link

share|improve this question
up vote 0 down vote accepted

Can't you just target .current-menu-item along with .current_page_item?

share|improve this answer

It's a bit hard for WP to figure that your custom menu item is the active one. They are for external links, after all, so it might not even be your WP install anymore. Since WP generates the menu on every page load it simply tries to figure right then what the active menu item is.

To overcome your isse...firstly, assess if you can do what you need to do without placing a custom menu item. If you still see your WP menu on that 'custom' target, chances are you can add it to the menu by other means.

If, for whatever reason, that's not an option, compare the style classes attached to your <body> tag with the ones attached to the menu entry. For instance, if have a page linked that on result shows page-id-2 on the body tag and page-item-2 on the menu entry.

Adjust your stylesheet to highlight the combination of that as active, for instance in my case it would be an entry

body.page-item-2 #menu-main-menu .page-id-2 {
    whatever: styles;
    are: suitable;

Also note that you have limited control over at least one entry in the menu items classes by adjusting the menu entry slug.

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.