• Hello There!
    Hello everyone I have a big problem with a custom post type.
    I create a custom post type named “event” with a rewrite => [“slug” => “Events”];
    and “show_in_menu” => true;
    In admin area I put the Events in primary menu that I have registered.
    I create a page named archive-event and a single-event and when I click on Events tag the current-menu-item goes on Events tag and the Blog tag as a result there are two active tags.
    I can not find a solution please help.

    Thank you!!

    • This topic was modified 7 years, 5 months ago by kostas65.
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Rewrite slugs (and post type names) need to follow the permalink slug rules: all lowercase alphabetic and numeric chars only. The only allowed special char is the hyphen -. Slugs must start with an alpha char. Your rewrite slug may match the post type name: “event”, but “Event” is inappropriate. You can have the associated labels be anything you like within the UTF-8 charset.

    I don’t know if slug case change will solve your menu issue, but it might. Using inappropriate slugs causes strange behavior in surprising ways. If you still have the menu issue, I have to think there is something in the menu structure that is inappropriate, such as the same ID occurring more than once or something similar. This shouldn’t happen with only the default wp_nav_menu() behavior, but there are all sorts of filters plugins and themes can hook into to change default behavior, which can corrupt the usual output.

    Try deactivating all plugins and switching to a default twenty* theme. Temporarily copy your corrected CPT code to the theme’s functions.php. Your menu should work correctly. Restore your theme and plugins, one at a time, checking menu behavior after each. When the behavior returns, the last activated module is at fault.

Viewing 1 replies (of 1 total)

The topic ‘About Current Menu Item’ is closed to new replies.