diff --git a/core/Requirement/Prohibited_categories.php b/core/Requirement/Prohibited_categories.php index c99f5cf9..a08fae67 100644 --- a/core/Requirement/Prohibited_categories.php +++ b/core/Requirement/Prohibited_categories.php @@ -193,12 +193,15 @@ private function get_list_categories($args = array('page' => 1, 'per_page' => 10 */ private function get_total_count($args = array('search' => '', 'hide_empty' => 0)) { - $args_key = base64_encode($args['search']); + $args_key = hash('sha256', (string) $args['search']); $cache_key = 'total_prohib_category_count_' . $args_key; $total_categories = get_transient($cache_key); if ($total_categories === false) { - $total_categories = wp_count_terms('category', $args); + // get_terms() with 'fields' => 'count' works the same from WP 5.5 to current, + // unlike the two wp_count_terms() signatures. + $total_categories = get_terms(array_merge($args, ['taxonomy' => 'category', 'fields' => 'count'])); + $total_categories = is_wp_error($total_categories) ? 0 : (int) $total_categories; set_transient($cache_key, $total_categories, $this->cache_expiration); } diff --git a/core/Requirement/Prohibited_tags.php b/core/Requirement/Prohibited_tags.php index ebfc58b1..fdb3c8ba 100644 --- a/core/Requirement/Prohibited_tags.php +++ b/core/Requirement/Prohibited_tags.php @@ -199,12 +199,15 @@ private function get_list_tags($args = array('page' => 1, 'per_page' => 10, 'q' */ private function get_total_count($args = array('search' => '', 'hide_empty' => 0)) { - $args_key = base64_encode($args['search']); + $args_key = hash('sha256', (string) $args['search']); $cache_key = 'total_prohib_tag_count_' . $args_key; $total_tags = get_transient($cache_key); if ($total_tags === false) { - $total_tags = wp_count_terms('post_tag', $args); + // get_terms() with 'fields' => 'count' works the same from WP 5.5 to current, + // unlike the two wp_count_terms() signatures. + $total_tags = get_terms(array_merge($args, ['taxonomy' => 'post_tag', 'fields' => 'count'])); + $total_tags = is_wp_error($total_tags) ? 0 : (int) $total_tags; set_transient($cache_key, $total_tags, $this->cache_expiration); } diff --git a/core/Requirement/Required_categories.php b/core/Requirement/Required_categories.php index 6042d8b1..cde9b496 100644 --- a/core/Requirement/Required_categories.php +++ b/core/Requirement/Required_categories.php @@ -194,12 +194,15 @@ private function get_list_categories($args = array('page' => 1, 'per_page' => 10 */ private function get_total_count($args = array('search' => '', 'hide_empty' => 0)) { - $args_key = base64_encode($args['search']); + $args_key = hash('sha256', (string) $args['search']); $cache_key = 'total_require_category_count_' . $args_key; $total_categories = get_transient($cache_key); if ($total_categories === false) { - $total_categories = wp_count_terms('category', $args); + // get_terms() with 'fields' => 'count' works the same from WP 5.5 to current, + // unlike the two wp_count_terms() signatures. + $total_categories = get_terms(array_merge($args, ['taxonomy' => 'category', 'fields' => 'count'])); + $total_categories = is_wp_error($total_categories) ? 0 : (int) $total_categories; set_transient($cache_key, $total_categories, $this->cache_expiration); } diff --git a/core/Requirement/Required_tags.php b/core/Requirement/Required_tags.php index 697192a9..68a2ec9b 100644 --- a/core/Requirement/Required_tags.php +++ b/core/Requirement/Required_tags.php @@ -199,12 +199,15 @@ private function get_list_tags($args = array('page' => 1, 'per_page' => 10, 'q' */ private function get_total_count($args = array('search' => '', 'hide_empty' => 0)) { - $args_key = base64_encode($args['search']); + $args_key = hash('sha256', (string) $args['search']); $cache_key = 'total_required_tag_count_' . $args_key; $total_tags = get_transient($cache_key); if ($total_tags === false) { - $total_tags = wp_count_terms('post_tag', $args); + // get_terms() with 'fields' => 'count' works the same from WP 5.5 to current, + // unlike the two wp_count_terms() signatures. + $total_tags = get_terms(array_merge($args, ['taxonomy' => 'post_tag', 'fields' => 'count'])); + $total_tags = is_wp_error($total_tags) ? 0 : (int) $total_tags; set_transient($cache_key, $total_tags, $this->cache_expiration); } diff --git a/modules/checklists/checklists.php b/modules/checklists/checklists.php index ad697390..a2693eb0 100644 --- a/modules/checklists/checklists.php +++ b/modules/checklists/checklists.php @@ -1662,7 +1662,7 @@ public function redirect_on_activate() { if (get_option('ppch_activated')) { delete_option('ppch_activated'); - wp_redirect(admin_url("admin.php?page=ppch-checklists")); + wp_safe_redirect(admin_url("admin.php?page=ppch-checklists")); exit; } } diff --git a/modules/checklists/templates/global-checklists.php b/modules/checklists/templates/global-checklists.php index 888673ff..a048ca45 100644 --- a/modules/checklists/templates/global-checklists.php +++ b/modules/checklists/templates/global-checklists.php @@ -24,6 +24,31 @@
'; + . esc_attr($hidden) . '>'; echo esc_html($sortDescription); echo '
'; }