qTranslate: Issues with Duplicate Content?

so i’ve been using this wordpress plugin that will help your site become multilingual called qTranslate. it’s awesome. it allows you to add different translations for menus, posts, pages, widgets, etc with a little bit of effort (of course, every project is different, some php coding may be required). here’s a fairly quick startup guide

the thing is, we only need the plugin for a set of pages and that’s it… not the most ideal solution, but it’s working… or was

i found a random issue that no amount of googling could resolve… every page that didn’t require translation would display fine except for the below snippet of code

essentially, the code was using “get_posts” to display a page within a page (almost inception-like)

$page = get_posts( array(
'post_type' => 'page'
) );

if ( $page )
if( $page[0]->post_content != ''){
echo '<div class="module">';
_e( $page[0]->post_content);
echo '</div>';

* note the “_e( $page[0]->post_content);” part

what would happen is if a change was made to that targeted page, the content would display X times, one after the other (where X is the number of languages set)

i noticed that it was calling “_e”, which is similar to using an “echo”

when you do an echo on content, it doesn’t apply any filters or anything and will simply display all the content in the editor

i modified the code like so:

$query = new WP_Query(
array (
'post_type' => 'page'
if ( $query->have_posts() ) {
while ( $query->have_posts() ) {
echo '<div class="module">';
echo '</div>';

the difference here is the use of “WP_Query” class. with it, i’m able to utilize “the_content()” so the appropriate filters are applied and boom, the proper content is displayed without any duplicates!

2 Responses to “qTranslate: Issues with Duplicate Content?”

  1. Noelia says:

    I have the same problem!!
    But I cant find where must be change the code solution.
    Can you help me??
    Which one php file?


    • Joey says:

      mine is a pretty specific issue so the file most likely won’t matter to you. check to see how “the_content()” is being called in your files.

      also, possibly change any “get_posts()” to “wp_query()” if possible

Leave a Reply