Polylang - Version 3.2.4

Version Description

(2022-06-07) =

  • Pro: Remove "Navigation menus" from the post type settings list
  • Pro: Fix block editor languages panel missing in WordPress 5.6
  • Pro: Fix wrongly indexed languages list returned by REST API when the first language is deactivated.
  • Revert fix for category feed not redirected when the language code is wrong #1054
  • Fix wrong redirect of category when the url includes a query string #1048
  • Fix querying multiple categories failing
Download this release

Release Info

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

Code changes from version 3.2.3 to 3.2.4

Files changed (3) hide show
  1. frontend/frontend-filters-links.php +18 -35
  2. polylang.php +2 -2
  3. readme.txt +10 -1
frontend/frontend-filters-links.php CHANGED
@@ -393,35 +393,33 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
393
  }
394
  }
395
 
396
- elseif ( is_category() || is_tag() || is_tax() ) {
 
397
  if ( $this->model->is_translated_taxonomy( $this->get_queried_taxonomy( $this->wp_query()->tax_query ) ) ) {
398
- if ( $this->links_model->using_permalinks && ( ! empty( $this->wp_query()->query['cat'] ) || ! empty( $this->wp_query()->query['tag'] ) || ! empty( $this->wp_query()->query['category_name'] ) ) ) {
399
- // When we receive a plain permalink with a cat or tag query var, we need to redirect to the pretty permalink.
400
- $term_id = $this->get_queried_term_id( $this->wp_query()->tax_query );
401
- if ( is_feed() ) {
402
- $redirect_url = $this->maybe_add_page_to_redirect_url( get_term_feed_link( $term_id, '' ) );
403
- } else {
404
- $redirect_url = $this->maybe_add_page_to_redirect_url( get_term_link( $term_id ) );
405
- }
406
- $language = $this->get_queried_term_language();
407
- } else {
408
- // We need to switch the language when there is no language provided in a pretty permalink.
409
- $obj = get_queried_object();
410
- if ( ! empty( $obj ) && $this->model->is_translated_taxonomy( $obj->taxonomy ) ) {
411
- $language = $this->model->term->get_language( (int) $obj->term_id );
412
- }
413
  }
414
  }
 
415
 
416
- if ( is_feed() && empty( $obj ) ) {
417
- // Allows to replace the language correctly in a category feed query.
418
- $language = $this->get_queried_term_language();
 
 
419
  }
420
  }
421
 
422
  elseif ( is_404() && ! empty( $this->wp_query()->tax_query ) ) {
423
  // When a wrong language is passed through a pretty permalink, we just need to switch the language.
424
- $language = $this->get_queried_term_language();
 
 
 
 
 
425
  }
426
 
427
  elseif ( $this->links_model->using_permalinks && $this->wp_query()->is_posts_page && ! empty( $this->wp_query()->query['page_id'] ) && $id = get_query_var( 'page_id' ) ) {
@@ -580,19 +578,4 @@ class PLL_Frontend_Filters_Links extends PLL_Filters_Links {
580
  protected function wp_query() {
581
  return $GLOBALS['wp_query'];
582
  }
583
-
584
- /**
585
- * Get the language corresponding to the queried term.
586
- *
587
- * @since 3.2
588
- *
589
- * @return PLL_Language|false The language object or false.
590
- */
591
- public function get_queried_term_language() {
592
- if ( $this->model->is_translated_taxonomy( $this->get_queried_taxonomy( $this->wp_query()->tax_query ) ) ) {
593
- $term_id = $this->get_queried_term_id( $this->wp_query()->tax_query );
594
- return $this->model->term->get_language( $term_id );
595
- }
596
- return false;
597
- }
598
  }
393
  }
394
  }
395
 
396
+ elseif ( $this->links_model->using_permalinks && is_category() && ! empty( $this->wp_query()->query['cat'] ) ) {
397
+ // When we receive a plain permaling with a cat query var, we need to redirect to the pretty permalink.
398
  if ( $this->model->is_translated_taxonomy( $this->get_queried_taxonomy( $this->wp_query()->tax_query ) ) ) {
399
+ $term_id = $this->get_queried_term_id( $this->wp_query()->tax_query );
400
+ if ( $term_id ) {
401
+ $language = $this->model->term->get_language( $term_id );
402
+ $redirect_url = $this->maybe_add_page_to_redirect_url( get_term_link( $term_id ) );
 
 
 
 
 
 
 
 
 
 
 
403
  }
404
  }
405
+ }
406
 
407
+ elseif ( is_category() || is_tag() || is_tax() ) {
408
+ // We need to switch the language when there is no language provided in a pretty permalink.
409
+ $obj = get_queried_object();
410
+ if ( ! empty( $obj ) && $this->model->is_translated_taxonomy( $obj->taxonomy ) ) {
411
+ $language = $this->model->term->get_language( (int) $obj->term_id );
412
  }
413
  }
414
 
415
  elseif ( is_404() && ! empty( $this->wp_query()->tax_query ) ) {
416
  // When a wrong language is passed through a pretty permalink, we just need to switch the language.
417
+ if ( $this->model->is_translated_taxonomy( $this->get_queried_taxonomy( $this->wp_query()->tax_query ) ) ) {
418
+ $term_id = $this->get_queried_term_id( $this->wp_query()->tax_query );
419
+ if ( $term_id ) {
420
+ $language = $this->model->term->get_language( $term_id );
421
+ }
422
+ }
423
  }
424
 
425
  elseif ( $this->links_model->using_permalinks && $this->wp_query()->is_posts_page && ! empty( $this->wp_query()->query['page_id'] ) && $id = get_query_var( 'page_id' ) ) {
578
  protected function wp_query() {
579
  return $GLOBALS['wp_query'];
580
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
581
  }
polylang.php CHANGED
@@ -10,7 +10,7 @@
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
- * Version: 3.2.3
14
  * Requires at least: 5.6
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
@@ -53,7 +53,7 @@ if ( defined( 'POLYLANG_VERSION' ) ) {
53
  }
54
  } else {
55
  // Go on loading the plugin
56
- define( 'POLYLANG_VERSION', '3.2.3' );
57
  define( 'PLL_MIN_WP_VERSION', '5.6' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
10
  * Plugin Name: Polylang
11
  * Plugin URI: https://polylang.pro
12
  * Description: Adds multilingual capability to WordPress
13
+ * Version: 3.2.4
14
  * Requires at least: 5.6
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '3.2.4' );
57
  define( 'PLL_MIN_WP_VERSION', '5.6' );
58
  define( 'PLL_MIN_PHP_VERSION', '5.6' );
59
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: multilingual, bilingual, translate, translation, language, multilanguage,
5
  Requires at least: 5.6
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
- Stable tag: 3.2.3
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -103,6 +103,15 @@ Wherever third party code has been used, credit has been given in the code’s c
103
 
104
  == Changelog ==
105
 
 
 
 
 
 
 
 
 
 
106
  = 3.2.3 (2022-05-17) =
107
 
108
  * Pro: Fix a fatal error when inserting a term
5
  Requires at least: 5.6
6
  Tested up to: 6.0
7
  Requires PHP: 5.6
8
+ Stable tag: 3.2.4
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
103
 
104
  == Changelog ==
105
 
106
+ = 3.2.4 (2022-06-07) =
107
+
108
+ * Pro: Remove "Navigation menus" from the post type settings list
109
+ * Pro: Fix block editor languages panel missing in WordPress 5.6
110
+ * Pro: Fix wrongly indexed languages list returned by REST API when the first language is deactivated.
111
+ * Revert fix for category feed not redirected when the language code is wrong #1054
112
+ * Fix wrong redirect of category when the url includes a query string #1048
113
+ * Fix querying multiple categories failing
114
+
115
  = 3.2.3 (2022-05-17) =
116
 
117
  * Pro: Fix a fatal error when inserting a term