From 4713d3d148b3da01e5114e921a2c49a7e1bc9224 Mon Sep 17 00:00:00 2001 From: Pascal Birchler Date: Wed, 11 Dec 2024 21:30:04 +0100 Subject: [PATCH] Only cache int values --- src/wp-includes/user.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/user.php b/src/wp-includes/user.php index 9be0759b5e409..48504702bbe94 100644 --- a/src/wp-includes/user.php +++ b/src/wp-includes/user.php @@ -589,12 +589,12 @@ function count_user_posts_for_post_type( $user_id, $post_type = 'post', $public_ // If cache is empty, query the database. if ( false === $count ) { - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ); + $count = absint( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts $where" ) ); wp_cache_add( $cache_key, $count, $cache_group ); } - return absint( $count ); + return $count; } /**