Selected Menu Link In WordPress Custom Theme Does Not Work

Solution:

You can use current-menu-item, because ti will be added to the page/posts/category that you are currently viewing. It’s not recommended to use current_page_item because it will be added only if the menu item is a page.