Polylang - Version 2.2.7

Version Description

(2017-11-30) =

  • Fix queries by taxonomy broken since WP 4.9
  • Fix PHP notice in icl_object_id()
Download this release

Release Info

Developer Chouby
Plugin Icon 128x128 Polylang
Version 2.2.7
Comparing to
See all releases

Code changes from version 2.2.6 to 2.2.7

frontend/frontend-filters.php CHANGED
@@ -156,6 +156,17 @@ class PLL_Frontend_Filters extends PLL_Filters {
156
  return $clauses;
157
  }
158
 
 
 
 
 
 
 
 
 
 
 
 
159
  // Adds our clauses to filter by language
160
  return $this->model->terms_clauses( $clauses, isset( $args['lang'] ) ? $args['lang'] : $this->curlang );
161
  }
156
  return $clauses;
157
  }
158
 
159
+ // Ugly hack to fix the issue introduced by WP 4.9. See also https://core.trac.wordpress.org/ticket/42104
160
+ if ( version_compare( $GLOBALS['wp_version'], '4.9', '>=' ) ) {
161
+ $traces = version_compare( PHP_VERSION, '5.2.5', '>=' ) ? debug_backtrace( false ) : debug_backtrace();
162
+
163
+ // PHP 7 does not include call_user_func
164
+ $n = version_compare( PHP_VERSION, '7', '>=' ) ? 5 : 6;
165
+ if ( isset( $traces[ $n ]['function'] ) && 'transform_query' === $traces[ $n ]['function'] ) {
166
+ return $clauses;
167
+ }
168
+ }
169
+
170
  // Adds our clauses to filter by language
171
  return $this->model->terms_clauses( $clauses, isset( $args['lang'] ) ? $args['lang'] : $this->curlang );
172
  }
modules/wpml/wpml-legacy-api.php CHANGED
@@ -162,21 +162,23 @@ if ( ! function_exists( 'icl_object_id' ) ) {
162
  *
163
  * @since 0.9.5
164
  *
165
- * @param int $id object id
166
- * @param string $type optional, post type or taxonomy name of the object, defaults to 'post'
167
- * @param bool $return_original_if_missing optional, true if Polylang should return the original id if the translation is missing, defaults to false
168
- * @param string $lang optional, language code, defaults to current language
169
- * @return int|null the object id of the translation, null if the translation is missing and $return_original_if_missing set to false
170
  */
171
  function icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = false ) {
172
  $lang = $lang ? $lang : pll_current_language();
173
 
174
  if ( 'nav_menu' === $type ) {
175
  $theme = get_option( 'stylesheet' );
176
- foreach ( PLL()->options['nav_menus'][ $theme ] as $loc => $menu ) {
177
- if ( array_search( $id, $menu ) && ! empty( $menu[ $lang ] ) ) {
178
- $tr_id = $menu[ $lang ];
179
- break;
 
 
180
  }
181
  }
182
  } elseif ( $pll_type = ( 'post' === $type || pll_is_translated_post_type( $type ) ) ? 'post' : ( 'term' === $type || pll_is_translated_taxonomy( $type ) ? 'term' : false ) ) {
162
  *
163
  * @since 0.9.5
164
  *
165
+ * @param int $id Object id
166
+ * @param string $type Optional, post type or taxonomy name of the object, defaults to 'post'
167
+ * @param bool $return_original_if_missing Optional, true if Polylang should return the original id if the translation is missing, defaults to false
168
+ * @param string $lang Optional, language code, defaults to current language
169
+ * @return int|null The object id of the translation, null if the translation is missing and $return_original_if_missing set to false
170
  */
171
  function icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = false ) {
172
  $lang = $lang ? $lang : pll_current_language();
173
 
174
  if ( 'nav_menu' === $type ) {
175
  $theme = get_option( 'stylesheet' );
176
+ if ( isset( PLL()->options['nav_menus'][ $theme ] ) ) {
177
+ foreach ( PLL()->options['nav_menus'][ $theme ] as $loc => $menu ) {
178
+ if ( array_search( $id, $menu ) && ! empty( $menu[ $lang ] ) ) {
179
+ $tr_id = $menu[ $lang ];
180
+ break;
181
+ }
182
  }
183
  }
184
  } elseif ( $pll_type = ( 'post' === $type || pll_is_translated_post_type( $type ) ) ? 'post' : ( 'term' === $type || pll_is_translated_taxonomy( $type ) ? 'term' : false ) ) {
polylang.php CHANGED
@@ -3,7 +3,7 @@
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
- Version: 2.2.6
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
@@ -35,7 +35,7 @@ if ( ! defined( 'ABSPATH' ) ) {
35
  exit; // don't access directly
36
  };
37
 
38
- define( 'POLYLANG_VERSION', '2.2.6' );
39
  define( 'PLL_MIN_WP_VERSION', '4.4' );
40
 
41
  define( 'POLYLANG_FILE', __FILE__ ); // this file
3
  /**
4
  Plugin Name: Polylang
5
  Plugin URI: https://polylang.pro
6
+ Version: 2.2.7
7
  Author: Frédéric Demarle
8
  Author uri: https://polylang.pro
9
  Description: Adds multilingual capability to WordPress
35
  exit; // don't access directly
36
  };
37
 
38
+ define( 'POLYLANG_VERSION', '2.2.7' );
39
  define( 'PLL_MIN_WP_VERSION', '4.4' );
40
 
41
  define( 'POLYLANG_FILE', __FILE__ ); // this file
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://polylang.pro
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
- Stable tag: 2.2.6
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
@@ -76,6 +76,11 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
79
  = 2.2.6 (2017-11-22) =
80
 
81
  * Pro: Fix query by post name and alternative language always returning the post in current language (when sharing slugs)
4
  Tags: multilingual, bilingual, translate, translation, language, multilanguage, international, localization
5
  Requires at least: 4.4
6
  Tested up to: 4.9
7
+ Stable tag: 2.2.7
8
  License: GPLv2 or later
9
 
10
  Making WordPress multilingual
76
 
77
  == Changelog ==
78
 
79
+ = 2.2.7 (2017-11-30) =
80
+
81
+ * Fix queries by taxonomy broken since WP 4.9
82
+ * Fix PHP notice in icl_object_id()
83
+
84
  = 2.2.6 (2017-11-22) =
85
 
86
  * Pro: Fix query by post name and alternative language always returning the post in current language (when sharing slugs)