I’m working on developing a WordPress site for my company. It’s basically going to be a blog type site with a handful of articles posted each month (usually at the same time). Each article will be translated into about 9 different languages.

I don’t want the URL to be in each different language, but also know that I can’t have 9 different articles with the same title, as WordPress adds a number to the end of each duplicate title (article1, article1-2, article1-3, etc.), right?

I know I can apply a different category to each post, changing the URL (/english/article1, /spanish/article1, etc.), but that still won’t help the post title part of the url.

Any recommendations for a good setup for this type of site? The site itself is already a sub domain... so should I creat sub domains within the sub domain (can I even do that?)

My company also has to use specific translators for legal purposes, so no translation plugins/services would work (although live translation would be ideal... just not an option at this point in time).

What would be some good option?

Thanks in advance!!


One option is a Rewrite Endpoint (or multiple endpoints).

The language would be appended to a single post URL, all translations could be stored in post meta attached to that single post.

For example, the article URL is:


with a single endpoint the translated article could be:


The code for adding that endpoint is pretty simple:

function wpd_language_endpoint() {
    add_rewrite_endpoint( 'lang', EP_PERMALINK );
add_action( 'init', 'wpd_language_endpoint' );

Then you can filter the_content() function to substitute the translation. For example, say the above translation is stored under the key lang_de, we check if a language has been requested and we output the translation if that key exists:

function wpd_language_content( $content ){
    if( false !== get_query_var( 'lang', false )
        && in_array( 'lang_' . get_query_var( 'lang' ), get_post_custom_keys( get_the_ID() ) ) ){
            return get_post_meta( get_the_ID(), 'lang_' . get_query_var( 'lang' ), true );
    return $content;
add_filter( 'the_content', 'wpd_language_content', 0 );

The multiple endpoint strategy would work much like above, but for a more abbreviated URL, you could add an endpoint for each language:

function wpd_language_endpoint() {
    add_rewrite_endpoint( 'de', EP_PERMALINK );
    add_rewrite_endpoint( 'es', EP_PERMALINK );
    add_rewrite_endpoint( 'ja', EP_PERMALINK );
    // etc..
add_action( 'init', 'wpd_language_endpoint' );

Then your URL would be:


Your other code would then have to change to possibly check from an array of potential languages to determine which has been requested. In that case, it's maybe easier to access the query object directly to get the language:

global $wp_query;

$languages = [
    'es' => 'es',
    'de' => 'de',
    'ja' => 'ja'

$keys = array_intersect_key( $languages, $wp_query->query );

if( ! empty( $keys ) ){
    $lang = current( $keys );
    echo 'language is' . $lang;
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy