Polylang - Version 3.1.2

Version Description

(2021-10-11) =

  • Pro: Fix parent page not filtered by language in the block editor since WP 5.6
  • Pro: Fix XLIFF mime type for PHP 7.0 and PHP 7.1
  • Fix settings page displaying the media modules whne no language are defined
  • Enforce Yoast SEO to use dynamic permalinks #882
  • Yoast SEO: Fix static front page and blog page breadcrumb
Download this release

Release Info

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

Code changes from version 3.1.1 to 3.1.2

changelog.txt CHANGED
@@ -2,6 +2,79 @@
2
 
3
  This file contains only old changelog. See readme.txt for newer versions.
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  = 2.9.2 (2021-02-02) =
6
 
7
  * Pro: Fix translation of CPTUI plural label and description not working
2
 
3
  This file contains only old changelog. See readme.txt for newer versions.
4
 
5
+ = 3.0.6 (2021-06-22) =
6
+
7
+ * Fix a conflict with the WooCommerce cart translation and cache plugins #876
8
+
9
+ = 3.0.5 (2021-06-08) =
10
+
11
+ * Pro: fix original post not assigned to a new translation when the languages sidebar is closed
12
+ * Pro: Attempt to fix zip file corrupted on some installations when exporting string translations
13
+ * Support session cookie with the pll_cookie_expiration filter #835
14
+ * Fix javascript error when a plugin defines its own editor for translated post types #837
15
+ * Fix languages displayed in screen options when editing a term #850
16
+ * Cache: fix post type archive cache not cleared when saving a post #828
17
+
18
+ = 3.0.4 (2021-04-27) =
19
+
20
+ * Improve performance in the pages (or hierarchical post types) list table
21
+ * Fix an ajax conflict with WooCommerce License manager
22
+
23
+ = 3.0.3 (2021-03-23) =
24
+
25
+ * Fix a warning when a language is corrupted in database (term_language missing)
26
+ * Fix confirmation modal with WooCommerce and WordPress < 5.6
27
+ * Fix an ajax conflict with WooCommerce Tree Table Rate Shipping and HubSpot All-In-One Marketing
28
+
29
+ = 3.0.2 (2021-03-16) =
30
+
31
+ * Move hreflang attributes higher in the head section #771
32
+ * Fix custom flags not working (introduced in 3.0)
33
+ * Fix translation of the confirmation modal when changing the language of a post
34
+ * Fix js and css not loaded when Polylang is used as a mu-plugin (introduced in 3.0)
35
+ * Fix support for html5 stylesheet link tags #775
36
+ * Fix possible warning in frontend-filters-links.php
37
+ * Yoast SEO Premium: Take over the multilingual compatibility removed in Yoast SEO Premium 15.8 #796
38
+ * Yoast SEO: Fix CPT breadcrumb title when the option is left empty #794
39
+ * Yoast SEO: Fix sitemap.xml not redirected on secondary domains #789
40
+
41
+ = 3.0.1 (2021-03-10) =
42
+
43
+ * Fix media gallery messed when editing a post in the classic editor
44
+ * Fix missing script dependency on old WP versions
45
+ * Fix CSS conflict with WooCommerce Bookings for WP < 5.6
46
+ * Fix conflict resulting in '__' already defined in block-editor.js. #779
47
+ * Fix search form removed for some themes. Props Marián Kadaňka. #780
48
+ * Fix fatal error with very old versions of Yoast SEO. Props Nicola Peluchetti. #781
49
+
50
+ = 3.0 (2021-03-08) =
51
+
52
+ * Add compatibility with WordPress 5.7
53
+ * Remove upgrades from Polylang older than 1.8
54
+ * Remove deprecated class PLL_Pointer
55
+ * Pro: Hide the license keys
56
+ * Pro: Fix redirect to the home page of a deactivated language
57
+ * Pro: Fix synchronization of post status not working
58
+ * Pro: Fix language switcher block not working in a post retrieved in REST API
59
+ * Pro: Fix PO export of strings with line breaks
60
+ * Pro: Fix file block title customization lost
61
+ * Add a dialog box to ask a confirmation about a language change in classic and block editors
62
+ * Improve browser language detection #591
63
+ * Improve robustness and documentation of code
64
+ * Fix media library after the language has been chnaged in the editor metabox
65
+ * Fix duplicated title attribute on flag link in posts list
66
+ * Fix legacy block editor language metabox compatibility with WordPress 5.6
67
+ * Fix uploaded theme and plugin files in media library
68
+ * Fix site title not translated in email change confirmation email
69
+ * Fix remaining deprecated jQuery notices #741
70
+ * Fix compatibility with GN publisher
71
+ * Fix compatibility with Woodmart theme search form
72
+ * Fix compatibility issue with 3rd party ajax requests since jQuery 3.3 #744
73
+ * Fix CSS conflict with WooCommerce Bookings
74
+ * Fix browser error when displaying an embed and using a cache plugin #757
75
+ * Fix post type archive title and metadesc not translated in Yoast SEO
76
+ * Fix PHP notice in REST API
77
+
78
  = 2.9.2 (2021-02-02) =
79
 
80
  * Pro: Fix translation of CPTUI plural label and description not working
include/crud-posts.php CHANGED
@@ -43,7 +43,7 @@ class PLL_CRUD_Posts {
43
 
44
  add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
45
  add_action( 'set_object_terms', array( $this, 'set_object_terms' ), 10, 4 );
46
- add_filter( 'wp_insert_post_parent', array( $this, 'wp_insert_post_parent' ), 10, 4 );
47
  add_action( 'before_delete_post', array( $this, 'delete_post' ) );
48
 
49
  // Specific for media
@@ -187,26 +187,19 @@ class PLL_CRUD_Posts {
187
  }
188
 
189
  /**
190
- * Make sure that the post parent is in the correct language when using bulk edit
191
  *
192
  * @since 1.8
193
  *
194
- * @param int $post_parent Post parent ID.
195
- * @param int $post_id Post ID.
196
- * @param array $new_postarr Array of parsed post data.
197
- * @param array $postarr Array of sanitized, but otherwise unmodified post data.
198
  * @return int
199
  */
200
- public function wp_insert_post_parent( $post_parent, $post_id, $new_postarr, $postarr ) {
201
- if ( isset( $postarr['bulk_edit'], $postarr['inline_lang_choice'] ) ) {
202
- check_admin_referer( 'bulk-posts' );
203
- $lang = -1 == $postarr['inline_lang_choice'] ?
204
- $this->model->post->get_language( $post_id ) :
205
- $this->model->get_language( $postarr['inline_lang_choice'] );
206
- // Dont break the hierarchy in case the post has no language
207
- if ( ! empty( $lang ) ) {
208
- $post_parent = $this->model->post->get_translation( $post_parent, $lang );
209
- }
210
  }
211
  return $post_parent;
212
  }
43
 
44
  add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
45
  add_action( 'set_object_terms', array( $this, 'set_object_terms' ), 10, 4 );
46
+ add_filter( 'wp_insert_post_parent', array( $this, 'wp_insert_post_parent' ), 10, 2 );
47
  add_action( 'before_delete_post', array( $this, 'delete_post' ) );
48
 
49
  // Specific for media
187
  }
188
 
189
  /**
190
+ * Make sure that the post parent is in the correct language.
191
  *
192
  * @since 1.8
193
  *
194
+ * @param int $post_parent Post parent ID.
195
+ * @param int $post_id Post ID.
 
 
196
  * @return int
197
  */
198
+ public function wp_insert_post_parent( $post_parent, $post_id ) {
199
+ $lang = $this->model->post->get_language( $post_id );
200
+ // Dont break the hierarchy in case the post has no language
201
+ if ( ! empty( $lang ) ) {
202
+ $post_parent = $this->model->post->get_translation( $post_parent, $lang );
 
 
 
 
 
203
  }
204
  return $post_parent;
205
  }
integrations/wpseo/wpseo.php CHANGED
@@ -17,6 +17,7 @@ class PLL_WPSEO {
17
  */
18
  public function init() {
19
  add_action( 'wp_loaded', array( $this, 'wpseo_translate_options' ) );
 
20
 
21
  if ( PLL() instanceof PLL_Frontend ) {
22
  // Filters sitemap queries to remove inactive language or to get
@@ -366,7 +367,6 @@ class PLL_WPSEO {
366
  public function frontend_presentation( $presentation ) {
367
  switch ( $presentation->model->object_type ) {
368
  case 'home-page':
369
- $presentation->model->permalink = pll_home_url();
370
  $presentation->model->title = WPSEO_Options::get( 'title-home-wpseo' );
371
  $presentation->model->description = WPSEO_Options::get( 'metadesc-home-wpseo' );
372
  $presentation->model->open_graph_title = WPSEO_Options::get( 'og_frontpage_title' );
@@ -375,16 +375,11 @@ class PLL_WPSEO {
375
 
376
  case 'post-type-archive':
377
  if ( pll_is_translated_post_type( $presentation->model->object_sub_type ) ) {
378
- $presentation->model->permalink = get_post_type_archive_link( $presentation->model->object_sub_type );
379
  $presentation->model->title = WPSEO_Options::get( 'title-ptarchive-' . $presentation->model->object_sub_type );
380
  $presentation->model->description = WPSEO_Options::get( 'metadesc-ptarchive-' . $presentation->model->object_sub_type );
381
  }
382
  break;
383
 
384
- case 'user':
385
- $presentation->model->permalink = get_author_posts_url( $presentation->model->object_id );
386
- break;
387
-
388
  case 'system-page':
389
  switch ( $presentation->model->object_sub_type ) {
390
  case '404':
@@ -401,29 +396,30 @@ class PLL_WPSEO {
401
  }
402
 
403
  /**
404
- * Fixes the breadcrumb links and strings stored in the indexable table since Yoast SEO 14.0
 
 
405
  *
406
  * @since 2.8.3
407
  *
408
  * @param array $indexables An array of Indexable objects.
409
- * @return object
410
  */
411
  public function breadcrumb_indexables( $indexables ) {
412
  foreach ( $indexables as &$indexable ) {
413
- switch ( $indexable->object_type ) {
414
- case 'home-page':
415
- $indexable->permalink = pll_home_url();
416
- $indexable->breadcrumb_title = pll__( WPSEO_Options::get( 'breadcrumbs-home' ) );
417
- break;
418
-
419
- case 'post-type-archive':
420
- if ( pll_is_translated_post_type( $indexable->object_sub_type ) ) {
421
- $indexable->permalink = get_post_type_archive_link( $indexable->object_sub_type );
422
- $breadcrumb_title = WPSEO_Options::get( 'bctitle-ptarchive-' . $indexable->object_sub_type );
423
- $breadcrumb_title = $breadcrumb_title ? $breadcrumb_title : $indexable->breadcrumb_title; // The option may be empty.
424
- $indexable->breadcrumb_title = pll__( $breadcrumb_title );
425
- }
426
- break;
427
  }
428
  }
429
 
17
  */
18
  public function init() {
19
  add_action( 'wp_loaded', array( $this, 'wpseo_translate_options' ) );
20
+ add_filter( 'wpseo_dynamic_permalinks_enabled', '__return_true', 999 );
21
 
22
  if ( PLL() instanceof PLL_Frontend ) {
23
  // Filters sitemap queries to remove inactive language or to get
367
  public function frontend_presentation( $presentation ) {
368
  switch ( $presentation->model->object_type ) {
369
  case 'home-page':
 
370
  $presentation->model->title = WPSEO_Options::get( 'title-home-wpseo' );
371
  $presentation->model->description = WPSEO_Options::get( 'metadesc-home-wpseo' );
372
  $presentation->model->open_graph_title = WPSEO_Options::get( 'og_frontpage_title' );
375
 
376
  case 'post-type-archive':
377
  if ( pll_is_translated_post_type( $presentation->model->object_sub_type ) ) {
 
378
  $presentation->model->title = WPSEO_Options::get( 'title-ptarchive-' . $presentation->model->object_sub_type );
379
  $presentation->model->description = WPSEO_Options::get( 'metadesc-ptarchive-' . $presentation->model->object_sub_type );
380
  }
381
  break;
382
 
 
 
 
 
383
  case 'system-page':
384
  switch ( $presentation->model->object_sub_type ) {
385
  case '404':
396
  }
397
 
398
  /**
399
+ * Fixes the breadcrumb links and strings stored in the indexable table since Yoast SEO 14.0.
400
+ *
401
+ * In version 17.0, the breadcrumb links do not honor the filter `wpseo_dynamic_permalinks_enabled`.
402
  *
403
  * @since 2.8.3
404
  *
405
  * @param array $indexables An array of Indexable objects.
406
+ * @return array
407
  */
408
  public function breadcrumb_indexables( $indexables ) {
409
  foreach ( $indexables as &$indexable ) {
410
+ if ( 'home-page' === $indexable->object_type || ( 'post' === $indexable->object_type && 'page' === $indexable->object_sub_type && get_option( 'page_on_front' ) === $indexable->object_id ) ) {
411
+ // Handles both when the front page displays the list of posts or a static page.
412
+ $indexable->permalink = pll_home_url();
413
+ $indexable->breadcrumb_title = pll__( WPSEO_Options::get( 'breadcrumbs-home' ) );
414
+ } elseif ( 'post' === $indexable->object_type && 'page' === $indexable->object_sub_type && get_option( 'page_for_posts' ) === $indexable->object_id ) {
415
+ $indexable->permalink = get_permalink( $indexable->object_id );
416
+ } elseif ( 'post-type-archive' === $indexable->object_type && pll_is_translated_post_type( $indexable->object_sub_type ) ) {
417
+ $indexable->permalink = get_post_type_archive_link( $indexable->object_sub_type );
418
+ $breadcrumb_title = WPSEO_Options::get( 'bctitle-ptarchive-' . $indexable->object_sub_type );
419
+ $breadcrumb_title = $breadcrumb_title ? $breadcrumb_title : $indexable->breadcrumb_title; // The option may be empty.
420
+ $indexable->breadcrumb_title = pll__( $breadcrumb_title );
421
+ } elseif ( 'term' === $indexable->object_type && pll_is_translated_taxonomy( $indexable->object_sub_type ) ) {
422
+ $indexable->permalink = get_term_link( $indexable->object_id );
 
423
  }
424
  }
425
 
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.1.1
14
  * Requires at least: 5.4
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.1.1' );
57
  define( 'PLL_MIN_WP_VERSION', '5.4' );
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.1.2
14
  * Requires at least: 5.4
15
  * Requires PHP: 5.6
16
  * Author: WP SYNTEX
53
  }
54
  } else {
55
  // Go on loading the plugin
56
+ define( 'POLYLANG_VERSION', '3.1.2' );
57
  define( 'PLL_MIN_WP_VERSION', '5.4' );
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.4
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 3.1.1
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -78,6 +78,14 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
78
 
79
  == Changelog ==
80
 
 
 
 
 
 
 
 
 
81
  = 3.1.1 (2021-08-16) =
82
 
83
  * Pro: Fix a fatal error with The Events Calendar
@@ -108,77 +116,4 @@ Don't hesitate to [give your feedback](http://wordpress.org/support/view/plugin-
108
  * Fix when more than one language switcher are added to the same menu #853
109
  * Fix PHP notice when adding a CPT archive link to a menu #868 Props davidwebca
110
 
111
- = 3.0.6 (2021-06-22) =
112
-
113
- * Fix a conflict with the WooCommerce cart translation and cache plugins #876
114
-
115
- = 3.0.5 (2021-06-08) =
116
-
117
- * Pro: fix original post not assigned to a new translation when the languages sidebar is closed
118
- * Pro: Attempt to fix zip file corrupted on some installations when exporting string translations
119
- * Support session cookie with the pll_cookie_expiration filter #835
120
- * Fix javascript error when a plugin defines its own editor for translated post types #837
121
- * Fix languages displayed in screen options when editing a term #850
122
- * Cache: fix post type archive cache not cleared when saving a post #828
123
-
124
- = 3.0.4 (2021-04-27) =
125
-
126
- * Improve performance in the pages (or hierarchical post types) list table
127
- * Fix an ajax conflict with WooCommerce License manager
128
-
129
- = 3.0.3 (2021-03-23) =
130
-
131
- * Fix a warning when a language is corrupted in database (term_language missing)
132
- * Fix confirmation modal with WooCommerce and WordPress < 5.6
133
- * Fix an ajax conflict with WooCommerce Tree Table Rate Shipping and HubSpot All-In-One Marketing
134
-
135
- = 3.0.2 (2021-03-16) =
136
-
137
- * Move hreflang attributes higher in the head section #771
138
- * Fix custom flags not working (introduced in 3.0)
139
- * Fix translation of the confirmation modal when changing the language of a post
140
- * Fix js and css not loaded when Polylang is used as a mu-plugin (introduced in 3.0)
141
- * Fix support for html5 stylesheet link tags #775
142
- * Fix possible warning in frontend-filters-links.php
143
- * Yoast SEO Premium: Take over the multilingual compatibility removed in Yoast SEO Premium 15.8 #796
144
- * Yoast SEO: Fix CPT breadcrumb title when the option is left empty #794
145
- * Yoast SEO: Fix sitemap.xml not redirected on secondary domains #789
146
-
147
- = 3.0.1 (2021-03-10) =
148
-
149
- * Fix media gallery messed when editing a post in the classic editor
150
- * Fix missing script dependency on old WP versions
151
- * Fix CSS conflict with WooCommerce Bookings for WP < 5.6
152
- * Fix conflict resulting in '__' already defined in block-editor.js. #779
153
- * Fix search form removed for some themes. Props Marián Kadaňka. #780
154
- * Fix fatal error with very old versions of Yoast SEO. Props Nicola Peluchetti. #781
155
-
156
- = 3.0 (2021-03-08) =
157
-
158
- * Add compatibility with WordPress 5.7
159
- * Remove upgrades from Polylang older than 1.8
160
- * Remove deprecated class PLL_Pointer
161
- * Pro: Hide the license keys
162
- * Pro: Fix redirect to the home page of a deactivated language
163
- * Pro: Fix synchronization of post status not working
164
- * Pro: Fix language switcher block not working in a post retrieved in REST API
165
- * Pro: Fix PO export of strings with line breaks
166
- * Pro: Fix file block title customization lost
167
- * Add a dialog box to ask a confirmation about a language change in classic and block editors
168
- * Improve browser language detection #591
169
- * Improve robustness and documentation of code
170
- * Fix media library after the language has been chnaged in the editor metabox
171
- * Fix duplicated title attribute on flag link in posts list
172
- * Fix legacy block editor language metabox compatibility with WordPress 5.6
173
- * Fix uploaded theme and plugin files in media library
174
- * Fix site title not translated in email change confirmation email
175
- * Fix remaining deprecated jQuery notices #741
176
- * Fix compatibility with GN publisher
177
- * Fix compatibility with Woodmart theme search form
178
- * Fix compatibility issue with 3rd party ajax requests since jQuery 3.3 #744
179
- * Fix CSS conflict with WooCommerce Bookings
180
- * Fix browser error when displaying an embed and using a cache plugin #757
181
- * Fix post type archive title and metadesc not translated in Yoast SEO
182
- * Fix PHP notice in REST API
183
-
184
  See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog
5
  Requires at least: 5.4
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
+ Stable tag: 3.1.2
9
  License: GPLv3 or later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
78
 
79
  == Changelog ==
80
 
81
+ = 3.1.2 (2021-10-11) =
82
+
83
+ * Pro: Fix parent page not filtered by language in the block editor since WP 5.6
84
+ * Pro: Fix XLIFF mime type for PHP 7.0 and PHP 7.1
85
+ * Fix settings page displaying the media modules whne no language are defined
86
+ * Enforce Yoast SEO to use dynamic permalinks #882
87
+ * Yoast SEO: Fix static front page and blog page breadcrumb
88
+
89
  = 3.1.1 (2021-08-16) =
90
 
91
  * Pro: Fix a fatal error with The Events Calendar
116
  * Fix when more than one language switcher are added to the same menu #853
117
  * Fix PHP notice when adding a CPT archive link to a menu #868 Props davidwebca
118
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  See [changelog.txt](https://plugins.svn.wordpress.org/polylang/trunk/changelog.txt) for older changelog