Version Description
This patch addresses an oversight whence primary terms could no longer get fetched.
Download this release
Release Info
Developer | Cybr |
Plugin | The SEO Framework |
Version | 4.1.5.1 |
Comparing to | |
See all releases |
Code changes from version 4.1.5 to 4.1.5.1
- autodescription.php +1 -1
- inc/classes/post-data.class.php +8 -3
- readme.txt +5 -1
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.1.5
|
7 |
* Author: The SEO Framework Team
|
8 |
* Author URI: https://theseoframework.com/
|
9 |
* License: GPLv3
|
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.1.5.1
|
7 |
* Author: The SEO Framework Team
|
8 |
* Author URI: https://theseoframework.com/
|
9 |
* License: GPLv3
|
inc/classes/post-data.class.php
CHANGED
@@ -821,8 +821,10 @@ class Post_Data extends Detect {
|
|
821 |
* Returns the primary term for post.
|
822 |
*
|
823 |
* @since 3.0.0
|
824 |
-
* @since 4.1.5
|
825 |
-
*
|
|
|
|
|
826 |
*
|
827 |
* @param int $post_id The post ID.
|
828 |
* @param string $taxonomy The taxonomy name.
|
@@ -835,7 +837,7 @@ class Post_Data extends Detect {
|
|
835 |
if ( isset( $primary_terms[ $post_id ][ $taxonomy ] ) )
|
836 |
return $primary_terms[ $post_id ][ $taxonomy ];
|
837 |
|
838 |
-
$primary_id = \get_post_meta( $post_id, '_primary_term_' . $taxonomy, true ) ?: 0;
|
839 |
|
840 |
if ( ! $primary_id ) return $primary_terms[ $post_id ][ $taxonomy ] = false;
|
841 |
|
@@ -847,6 +849,9 @@ class Post_Data extends Detect {
|
|
847 |
$terms = \get_the_terms( $post_id, $taxonomy );
|
848 |
$primary_term = false;
|
849 |
|
|
|
|
|
|
|
850 |
foreach ( $terms as $term ) {
|
851 |
if ( $primary_id === (int) $term->term_id ) {
|
852 |
$primary_term = $term;
|
821 |
* Returns the primary term for post.
|
822 |
*
|
823 |
* @since 3.0.0
|
824 |
+
* @since 4.1.5 1. Added memoization.
|
825 |
+
* 2. The first and second parameters are now required.
|
826 |
+
* @since 4.1.5.1 1. No longer causes a PHP warning in the unlikely event a post's taxonomy gets deleted.
|
827 |
+
* 2. This method now converts the post meta to an integer, making the comparison work again.
|
828 |
*
|
829 |
* @param int $post_id The post ID.
|
830 |
* @param string $taxonomy The taxonomy name.
|
837 |
if ( isset( $primary_terms[ $post_id ][ $taxonomy ] ) )
|
838 |
return $primary_terms[ $post_id ][ $taxonomy ];
|
839 |
|
840 |
+
$primary_id = (int) \get_post_meta( $post_id, '_primary_term_' . $taxonomy, true ) ?: 0;
|
841 |
|
842 |
if ( ! $primary_id ) return $primary_terms[ $post_id ][ $taxonomy ] = false;
|
843 |
|
849 |
$terms = \get_the_terms( $post_id, $taxonomy );
|
850 |
$primary_term = false;
|
851 |
|
852 |
+
// Test for otherwise foreach emits a PHP warning in the unlikely event a post's taxonomy is gone.
|
853 |
+
if ( ! \is_array( $terms ) ) return $primary_terms[ $post_id ][ $taxonomy ] = false;
|
854 |
+
|
855 |
foreach ( $terms as $term ) {
|
856 |
if ( $primary_id === (int) $term->term_id ) {
|
857 |
$primary_term = $term;
|
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.1.0
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.6.0
|
8 |
-
Stable tag: 4.1.5
|
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.1.5 =
|
251 |
|
252 |
This minor update adds support for Gutenberg 11.3.0 and [fixes a few bugs](https://theseoframework.com/?p=3756#detailed).
|
5 |
Requires at least: 5.1.0
|
6 |
Tested up to: 5.8
|
7 |
Requires PHP: 5.6.0
|
8 |
+
Stable tag: 4.1.5.1
|
9 |
License: GPLv3
|
10 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
11 |
|
247 |
|
248 |
== Changelog ==
|
249 |
|
250 |
+
= 4.1.5.1 =
|
251 |
+
|
252 |
+
This patch addresses an oversight whence primary terms could no longer get fetched.
|
253 |
+
|
254 |
= 4.1.5 =
|
255 |
|
256 |
This minor update adds support for Gutenberg 11.3.0 and [fixes a few bugs](https://theseoframework.com/?p=3756#detailed).
|