Are you looking to add a CSS class to the menu item that is currently the active screen?
If so, this is handled in WordPress by default with the “.current-menu-item” CSS class.
Related Posts:
- Mega Menu Walker
- start_lvl Ignored in Custom walker_nav_menu
- Displaying Logged-In User Name in WordPress Menu
- Menu Items Disappearing
- wp_delete_auto_drafts() deletes links in menus
- Check if a menu is empty?
- How can I hook into and edit the text of a wp_nav_menu tag?
- Walker class: Problems with understanding how walk() method can be called without error
- How to Use the Function is_user_logged_in To Display Different Menus?
- Replacing a specific menu item
- How to show only parents subpages of current page item in vertical menu?
- How can I access the “description” of a menu item?
- removing tags from wp_list_pages() using PHP
- How can I add a class to a single menu item?
- Remove all nav menu classes ( but keep useful ones… )
- How can I add a custom class to only nav sub-menu > li > a items in WordPress?
- items_wrap not working
- Style wp_page_menu() items
- Have CSS Class Added with `is_page()` WP function
- Run a filter when a walker runs
- How to display conditional-content if wp_nav_menu( $args ) retruns something
- Multiple WordPress Menus that will only display all pages
- Input type search in Menu
- WP Walker using custom css classes
- Change list item content in menu navigation to add a child element with specific class
- Automatically adding new post categories to menu
- Custom Walker_Nav_Menu issue with variables on PHP 7.3
- Child page menu in sidebar
- Title Case WordPress Menu Items
- Trying to store submenu items to render out after main menu
- How to change menu order item
- get_the_title() gets printed out twice
- Two menus show up
- Register a menu – Error Header
- How to style one item from main navigation?
- Show About and Contact Us page when they’re clicked in the top menu.
- Parsing Menu Items and Blog Posts
- Add value to new attribute inside WordPress menu items
- Menu Items fail to save correctly, cause reset of related page metadata
- Dropdown menu for categories
- Menu Custom Data Attributes
- How to display different submenus?
- Get the name of menu item with wp_nav_menu
- How to modify mobile nav menu text in theme
- Output only links using wp_nav_menu()
- Get css class of menu item in custom menu structure
- How to add aria role and schema markup to custom walker container
- Extend Menu Walker Output
- how to add a div inside wp_page_menu
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- Why in this WordPress theme I can’t see the Main Menu?
- Show login greeting above sub-menu links?
- Why can’t I add a custom image in my navigation?
- Remove submenu item from list
- conditional: if is page, and all subpages
- Remove the Tag from wp_nav_menu
- Styling an “active” link outside of WordPress default menu
- Dynamic menu with custom post types
- Adding an Anchor Link to a wordpress menu using WPBakery Page Builder
- How to make only the valid active page of a multilevel menu active with – “.nav li.current-menu-item a”?
- Replace jQuery with PHP or CSS for Customized WordPress wp_nav_menu
- How to set Nav as a default menu in wordpress
- How to put 2 php codes in functions.php without site crashing
- wp_get_nav_menu_items() with ACF
- How to switch between two primary menus (programatically0
- Redirect User when they click Menu Option
- Used a code to revoke some dashboard menus for my contributors but for some reason it’s revoked me access to the editor [closed]
- Get Child of Child Pages in custom Menu
- How to give custom roles the capability to edit one Menu instead of every Menu
- Primary navigation menu with timed items from custom post type
- How to disable sub menu items from being created?
- Bring Font Awesome icons inside menu A tags
- Difference between “Walker_Nav_menu” and “walker”
- Fatal error when using array_diff() function inside of wp_update_nav_menu hook?
- Vertical Menu for one page only
- PHP drop down menu for my get_category child of
- How limit the width of a fixed menu-bar on scroll?
- Pulling a variable into the wp_nav_menu function
- Beyond widget side menu editing, with the php page, custom template
- Editing existing pre-created menus in PHP
- Two theme locations for two menus, but only one is showing up
- wp nav menu without label
- Contact form field in wordpress menu
- How to call a certain object/menubar in a PHP file
- Active class not working on custom menu link using add_menu_page
- Sidebar current menu item for parent
- Remove all nav menu classes except those which begin with certain letters
- How to add a code for lastpostdate after/inside a specific menu link?
- Add the “.current-menu-item” class to tag?
- WordPress adding in site URL to header links
- How to change the menu color
- Can’t remove menu items added by plugin
- Custom Links in Walker Class
- Nav Menu Display
- Adding a unique class to wp_nav_menu
- WordPress menu links with images & class selection
- Open WordPress Page from selected option dropdown
- Remove Unused Menu Locations
- Custom Navigation Bar JSON Syntax Error in JSON at Position 0
- Custom nav with bootstrap dropdown