[wp-trac] [WordPress Trac] #63261: Menu items incorrectly marked as current when page and taxonomy share the same object_id

WordPress Trac noreply at wordpress.org
Wed May 21 12:31:01 UTC 2025


#63261: Menu items incorrectly marked as current when page and taxonomy share the
same object_id
-------------------------------------------------+-------------------------
 Reporter:  nuadagency                           |       Owner:  audrasjb
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  6.9
Component:  Menus                                |     Version:  6.7.2
 Severity:  normal                               |  Resolution:
 Keywords:  has-patch reporter-feedback needs-   |     Focuses:
  test-info                                      |  accessibility
-------------------------------------------------+-------------------------

Comment (by nuadagency):

 Hi @SirLouen , thank you again for putting time into this — I really
 appreciate the effort and detailed feedback.

 I think the core of the issue might be a misunderstanding of the condition
 required to trigger this bug. Let me try to rephrase and clarify.

 **What specifically triggers this**
 The bug occurs only when:

 A WordPress Page (a WP_Post with post_type = page) and a taxonomy term
 (like a WooCommerce product_cat) share the same numeric ID.

 Both the Page and the Term are added to a navigation menu.

 The user visits a term archive page (e.g., /product-category/boots/).

 On that archive page, WordPress sees the term ID (e.g., 23) and flags both
 menu items with object_id = 23 as current, without checking whether
 they're the same type (post vs term).

 **Why your reproduction isn’t working**
 In your test, you're using a custom post type and a taxonomy attached to
 that same CPT. That relationship is expected in WordPress and doesn't
 replicate the bug.

 You're not creating the required mismatch of unrelated object types.

 **How to reproduce it accurately**
 Create a normal Page in WordPress — e.g., "About" with ID 23.

 Create a WooCommerce Product Category that happens to get term_id = 23.

 Add both the Page and Product Category to a nav menu.

 Visit the Product Category archive (/product-category/example/).

 Observe that both menu items get marked current-menu-item even though only
 the term is active.

 Let me know if that clears things up. It's a subtle bug, but easily
 reproducible in default/fresh WooCommerce installs.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/63261#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list