Skip to content

Commit

Permalink
Only cache int values
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Dec 11, 2024
1 parent 511202c commit 4713d3d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/wp-includes/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 4713d3d

Please sign in to comment.