Title: compitability issue with polylang plugin
Last modified: August 30, 2016

---

# compitability issue with polylang plugin

 *  [abhisheksuneri](https://wordpress.org/support/users/abhisheksuneri/)
 * (@abhisheksuneri)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/)
 * hi, first of all this is a great plugin which was working fine until I decided
   to turn my site bilingual. for this I am using polylang plugin. When I use both
   the plugin. I am getting following error.
 * FATAL ERROR: CALL TO A MEMBER FUNCTION GET_DEFAULT_LANGUAGE() ON A NON-OBJECT
   IN /HOME/BHAWNA180115/PUBLIC_HTML/WP-CONTENT/PLUGINS/MULTI-RATING/INCLUDES/CLASS-
   API.PHP ON LINE 714
 * I really want to use multi rating. Please help me with the issue.
 * [https://wordpress.org/plugins/multi-rating/](https://wordpress.org/plugins/multi-rating/)

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

 *  Plugin Author [dpowney](https://wordpress.org/support/users/dpowney/)
 * (@dpowney)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537802)
 * Hi there,
 * Multi Rating fully supports WPML. I’ll be making some updates to use the new 
   WPML hooks and filters which may resolve this issue for Polylang.
 * In the meantime, try adding this to your wp-config.php file:
    define(‘PLL_WPML_COMPAT’,
   false);
 * Daniel
 *  Thread Starter [abhisheksuneri](https://wordpress.org/support/users/abhisheksuneri/)
 * (@abhisheksuneri)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537883)
 * hi Daniel,
 * the code didn’t work. I am getting the same problem.
 *  [Pilar Mera](https://wordpress.org/support/users/decrecementofeliz/)
 * (@decrecementofeliz)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537911)
 * Hi, I have the same problem as Daniel.
 * The wp-config line solves the Multirating error, but also disables some Polylang
   functionalities (like String Translation of custom post type os custom taxonomies),
   so I hope you can post the update soon so we can use both plugins normally.
 * Thanks!
    Pilar
 *  Plugin Author [dpowney](https://wordpress.org/support/users/dpowney/)
 * (@dpowney)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537912)
 * There’s a GitHub issue to track this. [https://github.com/danielpowney/multi-rating/issues/36](https://github.com/danielpowney/multi-rating/issues/36).
   In WPML > 3.2 there’s a new filter which should resolve this issue. This is on
   my TODO list.
 * Daniel
 *  [Pilar Mera](https://wordpress.org/support/users/decrecementofeliz/)
 * (@decrecementofeliz)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537915)
 * Hi Daniel, thanks for answering.
 * But I’m afraid I can’t solve this hook thing on my own, and I can’t wait much
   longer for this problem to be solved (my site is going live soon), so I guess
   I’ll have to try with another plugin, although I really like yours 🙁
 * Unless you’re planning to update this in the next few days??
 * Regards,
    Pilar
 *  [Pilar Mera](https://wordpress.org/support/users/decrecementofeliz/)
 * (@decrecementofeliz)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537917)
 * Hi again.
 * I finally got into the code and could make it work, though I’m not sure these
   tricks are stable enough. Anyway, this is what I did, in case it can help somebody:
 * Basically, I converted each instance of `icl_object_id` function that appears
   on the plugin with the `wpml_object_id`filter, and removed all the conditional
   statements that were checking if `icl_object_id` exist.
    So:
 *     ```
       if ( function_exists( 'icl_object_id' ) ) {
       				$rating_result['post_id'] = icl_object_id( $temp_post_id , get_post_type( $temp_post_id ), true, ICL_LANGUAGE_CODE );
       			}
       ```
   
 * became:
 *     ```
       $rating_result['post_id'] = apply_filters('wpml_object_id', $temp_post_id, get_post_type( $temp_post_id ), true, ICL_LANGUAGE_CODE );
       ```
   
 * Another example:
 *     ```
       if ( function_exists( 'icl_object_id' ) ) {
       				global $sitepress;
       				$post_id = icl_object_id ( $post_id , get_post_type( $post_id ), true, $sitepress->get_default_language() );
       			}
       ```
   
 * Became:
 *     ```
       $defaultlanguage = pll_default_language();
       $post_id = apply_filters('wpml_object_id', $post_id, get_post_type( $post_id ), true, $defaultlanguage );
       ```
   
 * You just need to replace the parameters of the filter with the parameters of 
   the old function (`$post_id` or `$temp_post_id`, etc.)
 * The files that need to be changed as they contain these functions are:
    includes/
   class-rating-form.php includes/class-api.php includes/admin/tools.php includes/
   admin/class-rating-results-table.php includes/admin/class-rating-entry-table.
   php
 * Hope that helps, regards!
    Pilar

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

The topic ‘compitability issue with polylang plugin’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/multi-rating_d6dfe6.svg)
 * [Multi Rating](https://wordpress.org/plugins/multi-rating/)
 * [Support Threads](https://wordpress.org/support/plugin/multi-rating/)
 * [Active Topics](https://wordpress.org/support/plugin/multi-rating/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/multi-rating/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/multi-rating/reviews/)

## Tags

 * [polylang plugin](https://wordpress.org/support/topic-tag/polylang-plugin/)

 * 6 replies
 * 3 participants
 * Last reply from: [Pilar Mera](https://wordpress.org/support/users/decrecementofeliz/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/compitability-issue-with-polylang-plugin/#post-6537917)
 * Status: not resolved