Title: current menu item
Last modified: May 17, 2017

---

# current menu item

 *  Resolved [mowar](https://wordpress.org/support/users/mowar/)
 * (@mowar)
 * [9 years ago](https://wordpress.org/support/topic/current-menu-item-14/)
 * Hi! I have an issue related to your frontend-nav-menu.php file:
    \wp-content\
   plugins\polylang\frontend\frontend-nav-menu.php
 * From line 141. you have a code to remove the ‘current-menu-item’ classes:
 *     ```
       $item->classes = array_diff( $item->classes, array( 'current-menu-item' ) );
       $r_ids = array_merge( $r_ids, $this->get_ancestors( $item ) ); // Remove the classes for these ancestors
       ```
   
 * Now my problem is, that I have a plugin, that identifies current menu items not
   by their current-menu-item class, but by wether the ‘current’ attribute is true
   or false:
 *     ```
       if ($item->current) {
           /* $item is active */
       }
       ```
   
 * So what I would like to ask is, that could you also set this current attribute
   to false in your code, where you are removing the classes:
 *     ```
       $item->classes = array_diff( $item->classes, array( 'current-menu-item' ) );
       $item->current = false; /*new line*/
       $r_ids = array_merge( $r_ids, $this->get_ancestors( $item ) ); // Remove the classes for these ancestors
       ```
   
 * because I’m not sure, if checking an element wether or not it has the ‘current-
   menu-item’ class would be enough to identify which menu item is active, because
   theme developers might change this class name, but the current attribute should
   be correct.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [Chouby](https://wordpress.org/support/users/chouby/)
 * (@chouby)
 * [9 years ago](https://wordpress.org/support/topic/current-menu-item-14/#post-9141461)
 * Hi,
 * Could you open a GitHub issue for me not to forget that? Thanks.
 *  Thread Starter [mowar](https://wordpress.org/support/users/mowar/)
 * (@mowar)
 * [9 years ago](https://wordpress.org/support/topic/current-menu-item-14/#post-9145126)
 * Sure, I moved this topic there!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘current menu item’ is closed to new replies.

 * ![](https://ps.w.org/polylang/assets/icon-256x256.png?rev=3433336)
 * [Polylang](https://wordpress.org/plugins/polylang/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/polylang/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/polylang/)
 * [Active Topics](https://wordpress.org/support/plugin/polylang/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/polylang/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/polylang/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [mowar](https://wordpress.org/support/users/mowar/)
 * Last activity: [9 years ago](https://wordpress.org/support/topic/current-menu-item-14/#post-9145126)
 * Status: resolved