Waiting for author
Overview of the issue
When using AffiliateWP with the AffiliateWP Portal addon and WPML, custom menu links added to the Affiliate Portal display in both languages, but their labels are not translatable. There is no built-in option to translate these custom link labels.
Workaround
Please, make sure of having a full site backup of your site before proceeding.
- Open the …/wp-content/plugins/affiliatewp-affiliate-portal/includes/core/class-menu-links.php file.
- Look for line 102.
- Replace:
// filter only menu links with a page. $menu_links = array_filter( $menu_links, function( $menu_link) { return ! empty( $menu_link['id'] ); } );
- With:
// filter only menu links with a page. $menu_links = array_filter( $menu_links, function( $menu_link) { return ! empty( $menu_link['id'] ); } ); // WPML Workaround for compsupp-8049 - Register menu links labels with WPML foreach ( $menu_links as $index => &$link ) { if ( ! empty( $link['label'] ) ) { do_action( 'wpml_register_single_string', 'affiliatewp-portal-menu', 'portal_menu_link_label_' . $index, $link['label'] ); $link['label'] = apply_filters( 'wpml_translate_single_string', $link['label'], 'affiliatewp-portal-menu', 'portal_menu_link_label_' . $index ); } }
- Go to AffiliateWP > Settings > Affiliate Portal and resave your settings.
- Then go to WPML > String Translation to translate the custom menu link labels.