Skip to content

Commit

Permalink
Merge branch 'release/3.5.45'
Browse files Browse the repository at this point in the history
  • Loading branch information
andykillen committed Nov 18, 2024
2 parents a7bb4c9 + ee41088 commit 93a09dc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ If you want to build a local production-ready version of the plugin you can run

## Changelog

#### 3.5.45
* added extra checks to CacheTag creation to deal with plugins that prevent the ID from being readable on is_singular() queries

#### 3.5.44
* added extra checks to prevent php 8.3 deprecation errors on some requests.

Expand Down
5 changes: 4 additions & 1 deletion Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Donate link: https://servebolt.com
Requires at least: 4.9.2
Tested up to: 6.6.1
Requires PHP: 7.4
Stable tag: 3.5.44
Stable tag: 3.5.45
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -98,6 +98,9 @@ If you're a Servebolt client, please reach out to our Support Team and we'll be

== Changelog ==

= 3.5.45 =
* added extra checks to CacheTag creation to deal with plugins that prevent the ID from being readable on is_singular() queries

= 3.5.44 =
* added extra checks to prevent php 8.3 deprecation errors on some requests.

Expand Down
4 changes: 2 additions & 2 deletions servebolt-optimizer.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Servebolt Optimizer
Version: 3.5.44
Version: 3.5.45
Author: Servebolt
Author URI: https://servebolt.com
Description: A plugin that implements Servebolt Security & Performance best practises for WordPress.
Expand All @@ -18,7 +18,7 @@
define('SERVEBOLT_PLUGIN_DIR_URL', plugin_dir_url( __FILE__ ));
define('SERVEBOLT_PLUGIN_DIR_PATH', plugin_dir_path( __FILE__ ));
define('SERVEBOLT_PLUGIN_PSR4_PATH', SERVEBOLT_PLUGIN_DIR_PATH . 'src/Servebolt/');
define('SERVEBOLT_PLUGIN_MINIMUM_PHP_VERSION', '7.3');
define('SERVEBOLT_PLUGIN_MINIMUM_PHP_VERSION', '7.4');
define('SERVEBOLT_PLUGIN_ACD_VERSION', '7');
/**
* Added database version for increased flexibilty in updates.
Expand Down
11 changes: 8 additions & 3 deletions src/Servebolt/CacheTags/CacheTagsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ protected function addTaxonomyTermIDTag() : void

if(is_singular()) {
$taxonomies = get_object_taxonomies( get_post_type(), 'objects' );
if(is_wp_error($taxonomies) || !$taxonomies || empty($taxonomies)) return;
foreach($taxonomies as $tax) {
// ignore non public taxonomies
if(!$tax->public) continue;
Expand Down Expand Up @@ -222,7 +223,11 @@ protected function addAuthorTag() : void
if(is_singular()){
if(class_exists( 'woocommerce' ) && is_product()) return;

$this->add( self::AUTHOR . '-' . get_post_field('post_author', get_queried_object()->ID ) );
// Added check to prevent errors that some security plugins might cause. They do not allow access to the ID.
if(get_queried_object()->ID != null) {
$this->add( self::AUTHOR . '-' . get_post_field('post_author', get_queried_object()->ID ) );
}

}

}
Expand Down Expand Up @@ -269,8 +274,8 @@ protected function addRssTag() : void
$this->add(self::FEEDS);
}

if(is_feed() && is_singular()) {
$this->add(self::COMMENT_FEED. '-' . get_queried_object()->ID);
if(is_feed() && is_singular() && get_queried_object()->ID != null) {
$this->add(self::COMMENT_FEED. '-' . get_queried_object()->ID);
}
}

Expand Down

0 comments on commit 93a09dc

Please sign in to comment.