Skip to content Skip to sidebar

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 16 replies, has 0 voices.

Last updated by Gregory 2 months ago.

Assisted by: Otto.

Author Posts
November 17, 2025 at 7:41 pm #17586042

Otto
WPML Supporter since 09/2015

Languages: English (English ) Spanish (Español )

Timezone: America/Argentina/Buenos_Aires (GMT-03:00)

Hello Kelly,

Our second tier support provided a workaround that allows to edit the tag so they are connected as a translation. I know that you don't mind about connecting them, but if they are not, then WordPress does not know the right language when retrieving them by slug.

Please try the following:
❌ Please make a full website backup before proceeding ❌
In your child theme functions.php file add:

/**
 * Short-circuit the test for re-used tag slugs
 * when editing a tag 
 */
add_filter( 'terms_pre_query', 'wsmod_terms_pre_query', 10, 2 );
function wsmod_terms_pre_query( $terms, $term_query ){

    if ( 
        isset( $_REQUEST['taxonomy'] ) && $_REQUEST['taxonomy'] === 'post_tag' 
        && isset( $_REQUEST['action'] ) && $_REQUEST['action'] === 'editedtag' 
        && isset( $_REQUEST['tag_ID'] ) ) 
    {
        $term = get_term( $_REQUEST['tag_ID'], 'post_tag' );
        $terms = array( $term );
    }

    return $terms;
}

Then edit the English slug and connect it to the Greek one as a translation. After this, the title should appear in the right language in the front end.

Let me know how it goes, please.

Best Regards,
Otto

November 18, 2025 at 1:34 pm #17588234

Gregory

Hello Otto,

Thank you for your reply and for escalating the issue to the second tier.
We have implemented the code you've sent and, indeed, it is now possible to connect the terms. This is still not what we want, as we will have to manually connect all the affected terms. However, it is at least a way to address part of the issue.

So, although the issue is not 100% resolved, you can go ahead and close this.

Best regards
Kelly