Title: Does this plugin support Polylang?
Last modified: August 21, 2016

---

# Does this plugin support Polylang?

 *  Resolved [icakeov](https://wordpress.org/support/users/itucakov/)
 * (@itucakov)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/)
 * Hello
    I am looking for a plugin to track popular posts and I am currently also
   using the Polylang plugin to have different language websites. Because of this,
   with the most popular post plugin I will need to call the polylang custom taxonomy,
   for example “lang=en” in order to display only the english posts. Do you guys
   have a way of working with all this? Suggestions and comments appreciated.
 * [https://wordpress.org/plugins/top-10/](https://wordpress.org/plugins/top-10/)

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4573998)
 * The plugin doesn’t come with out of the box support for Polylang.
 * On line 379, I have:
 *     ```
       $result = get_post(apply_filters('tptn_post_id',$result->ID));	// Let's get the Post using the ID
       ```
   
 * You can write a function using `add_filter` which can be used to overwrite the
   language.
 * I’m not familiar with Polylang’s API. Please see this thread on using Top 10 
   with WPML and a sample function (I’ve not got confirmation on if its been tested).
 * [http://wordpress.org/support/topic/top-10-and-wpml?replies=6](http://wordpress.org/support/topic/top-10-and-wpml?replies=6)
 *  Thread Starter [icakeov](https://wordpress.org/support/users/itucakov/)
 * (@itucakov)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574013)
 * Thanks for the response Ajay.
    Found out that with the way Polylang works, it’s
   actually fine, I can just call the query using “meta_value_num” in combination
   with it.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574017)
 * Would this be independent of Top 10? Or do you have a working code that might
   help other users with both plugins?
 *  Thread Starter [icakeov](https://wordpress.org/support/users/itucakov/)
 * (@itucakov)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574026)
 * Hi Ajay
 * Polylang basically doubles Posts. I started with english versions and then I 
   created a spanish site with all the posts that is translated to spanish. They
   are distinguished by the “lang” taxonomy, so if I want to put up bunch of posts,
   I would just need to include that taxonomy in the array.
 * To my understanding if Top 10 updates “meta_value_num” and “meta_key” values,
   the query would find the right posts using all these taxonomies in combination.
 * For example:
    <?php query_posts( array( ‘meta_key’ => ‘views’, ‘orderby’ => ‘
   meta_value_num’, ‘order’ => ‘DESC’ ), ‘lang’ => ‘en’ ); ?> (note that meta_key
   can also be: ‘meta_key’ => ‘views’ depending on how a specific plugin works)
 * Does this help?
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574063)
 * Hi,
 * So if I understand correct, the English version has a post ID and the Spanish
   version has a different post ID?
 * If that is the case, then most likely Top 10 is counting the hits independently.
   These are saved in separate tables containing “tptn” in your WordPress database.
 * What you can try for now is get the posts IDs only using code similar to this(
   again, it’s not tested):
 *     ```
       $toppostsid = tptn_pop_posts('limit=10&posts_only=1');
       return new WP_Query( array(
       'post__in' => wp_list_pluck( $toppostsid, 'ID' ),
       'posts_per_page' => 3,
       'ignore_sticky_posts' => true,
       'post__not_in' => array( $post->ID ),
       'tax_query' => array(
       	array(
       		'taxonomy' => 'lang',
       		'field' => 'slug',
       		'terms' => 'en'
       	)
       )
       ```
   
 * Note that I’m going to be changing the above implementation of `tptn_pop_posts`
   in a future version which makes it easier to just get the top post IDs.
 *  Thread Starter [icakeov](https://wordpress.org/support/users/itucakov/)
 * (@itucakov)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574147)
 * Ok thanks, I still need to work on all this and will let you know if there are
   any problems.
    Looks pretty clear. Thanks for the help.
 *  Plugin Author [Ajay](https://wordpress.org/support/users/ajay/)
 * (@ajay)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574149)
 * You’re welcome. Do let me know the results. I plan on updating the FAQ to guide
   other visitors and this will definitely help.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Does this plugin support Polylang?’ is closed to new replies.

 * ![](https://ps.w.org/top-10/assets/icon-256x256.png?rev=2986432)
 * [WebberZone Top 10 — Popular Posts](https://wordpress.org/plugins/top-10/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/top-10/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/top-10/)
 * [Active Topics](https://wordpress.org/support/plugin/top-10/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/top-10/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/top-10/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [Ajay](https://wordpress.org/support/users/ajay/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/does-this-plugin-support-polylang-2/#post-4574149)
 * Status: resolved