diff --git a/wporg-gp-translation-events.php b/wporg-gp-translation-events.php index 0be43104..bf611a56 100644 --- a/wporg-gp-translation-events.php +++ b/wporg-gp-translation-events.php @@ -317,15 +317,19 @@ function register_translation_event_js() { /** * Add the events link to the GlotPress main menu. * - * @param array $items The menu items. + * @param array $items The menu items. + * @param string $location The menu location. * @return array The modified menu items. */ -function gp_event_nav_menu_items( array $items ): array { +function gp_event_nav_menu_items( array $items, string $location ): array { + if ( 'main' !== $location ) { + return $items; + } $new[ esc_url( gp_url( '/events/' ) ) ] = esc_html__( 'Events', 'gp-translation-events' ); return array_merge( $items, $new ); } // Add the events link to the GlotPress main menu. -add_filter( 'gp_nav_menu_items', 'Wporg\TranslationEvents\gp_event_nav_menu_items' ); +add_filter( 'gp_nav_menu_items', 'Wporg\TranslationEvents\gp_event_nav_menu_items', 10, 2 ); /** * Generate a slug for the event post type when we save a draft event.