The SEO Framework - Version 4.2.2

Version Description

This minor update addresses a regression where the homepage canonical URL was missing a trailing slash.

Download this release

Release Info

Developer Cybr
Plugin Icon 128x128 The SEO Framework
Version 4.2.2
Comparing to
See all releases

Code changes from version 4.2.1 to 4.2.2

autodescription.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: The SEO Framework
4
  * Plugin URI: https://theseoframework.com/
5
  * Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
6
- * Version: 4.2.1
7
  * Author: The SEO Framework Team
8
  * Author URI: https://theseoframework.com/
9
  * License: GPLv3
@@ -41,7 +41,7 @@ defined( 'ABSPATH' ) or die;
41
  *
42
  * @since 2.3.5
43
  */
44
- define( 'THE_SEO_FRAMEWORK_VERSION', '4.2.1' );
45
 
46
  /**
47
  * The plugin Database version.
3
  * Plugin Name: The SEO Framework
4
  * Plugin URI: https://theseoframework.com/
5
  * Description: An automated, advanced, accessible, unbranded and extremely fast SEO solution for your WordPress website.
6
+ * Version: 4.2.2
7
  * Author: The SEO Framework Team
8
  * Author URI: https://theseoframework.com/
9
  * License: GPLv3
41
  *
42
  * @since 2.3.5
43
  */
44
+ define( 'THE_SEO_FRAMEWORK_VERSION', '4.2.2' );
45
 
46
  /**
47
  * The plugin Database version.
inc/classes/generate-url.class.php CHANGED
@@ -327,29 +327,19 @@ class Generate_Url extends Generate_Title {
327
  $url = $this->add_url_pagination( $url, $this->paged(), true );
328
  }
329
 
330
- $parsed = parse_url( $url );
331
-
332
- // Don't slash the home URL if it's been modified by a (translation) plugin.
333
- if ( ! isset( $parsed['query'] ) ) {
334
- if ( isset( $parsed['path'] ) && '/' !== $parsed['path'] ) {
335
- $url = \user_trailingslashit( $url, 'home' );
336
- } else {
337
- $url = \trailingslashit( $url );
338
- }
339
- }
340
-
341
- return $url;
342
  }
343
 
344
  /**
345
- * Returns home canonical URL without pagination or slashing.
346
  *
347
  * @since 4.2.0
 
348
  *
349
- * @return string The home canonical URL without pagination.
350
  */
351
  public function get_raw_home_canonical_url() {
352
- return $this->set_preferred_url_scheme( $this->get_home_url() );
353
  }
354
 
355
  /**
@@ -1191,4 +1181,29 @@ class Generate_Url extends Generate_Title {
1191
  public function get_home_url() {
1192
  return umemo( __METHOD__ ) ?? umemo( __METHOD__, \get_home_url() );
1193
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1194
  }
327
  $url = $this->add_url_pagination( $url, $this->paged(), true );
328
  }
329
 
330
+ return $this->slash_root_url( $url );
 
 
 
 
 
 
 
 
 
 
 
331
  }
332
 
333
  /**
334
+ * Returns home canonical URL without query considerations.
335
  *
336
  * @since 4.2.0
337
+ * @since 4.2.2 Now adds a trailing slash if the URL is a root URL.
338
  *
339
+ * @return string The home canonical URL without query considerations.
340
  */
341
  public function get_raw_home_canonical_url() {
342
+ return $this->slash_root_url( $this->set_preferred_url_scheme( $this->get_home_url() ) );
343
  }
344
 
345
  /**
1181
  public function get_home_url() {
1182
  return umemo( __METHOD__ ) ?? umemo( __METHOD__, \get_home_url() );
1183
  }
1184
+
1185
+ /**
1186
+ * Slashes the root (home) URL.
1187
+ *
1188
+ * @since 4.2.2
1189
+ *
1190
+ * @param string $url The root URL.
1191
+ * @return string The root URL plausibly with added slashes.
1192
+ */
1193
+ protected function slash_root_url( $url ) {
1194
+
1195
+ $parsed = parse_url( $url );
1196
+
1197
+ // Don't slash the home URL if it's been modified by a (translation) plugin.
1198
+ if ( ! isset( $parsed['query'] ) ) {
1199
+ if ( isset( $parsed['path'] ) && '/' !== $parsed['path'] ) {
1200
+ // Paginated URL or subdirectory.
1201
+ $url = \user_trailingslashit( $url, 'home' );
1202
+ } else {
1203
+ $url = \trailingslashit( $url );
1204
+ }
1205
+ }
1206
+
1207
+ return $url;
1208
+ }
1209
  }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: seo, xml sitemap, google search, open graph, schema.org, twitter card, per
5
  Requires at least: 5.5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.2.0
8
- Stable tag: 4.2.1
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -247,6 +247,10 @@ If you wish to display breadcrumbs, then your theme should provide this. Alterna
247
 
248
  == Changelog ==
249
 
 
 
 
 
250
  = 4.2.1 =
251
 
252
  This minor update addresses a few regressions brought in v4.2.0; it fixes the canonical URL for paginated categories, corrects an API typo, and [rectifies a few edge cases](https://theseoframework.com/?p=3836). TSF now also supports PHP 8.1.
5
  Requires at least: 5.5.0
6
  Tested up to: 5.8
7
  Requires PHP: 7.2.0
8
+ Stable tag: 4.2.2
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
 
247
 
248
  == Changelog ==
249
 
250
+ = 4.2.2 =
251
+
252
+ This minor update addresses a regression where the homepage canonical URL was [missing a trailing slash](https://theseoframework.com/?p=3841).
253
+
254
  = 4.2.1 =
255
 
256
  This minor update addresses a few regressions brought in v4.2.0; it fixes the canonical URL for paginated categories, corrects an API typo, and [rectifies a few edge cases](https://theseoframework.com/?p=3836). TSF now also supports PHP 8.1.