Use count() instead of sizeof()

This commit is contained in:
Claudio Sanches 2016-10-17 13:31:49 -02:00 committed by Mike Jolley
parent 1c73ffb3f6
commit a5cf2922ee
1 changed files with 2 additions and 2 deletions

View File

@ -792,7 +792,7 @@ function wc_get_min_max_price_meta_query( $args ) {
* Get relateed products.
*
* @since 2.7.0
* @param int $product_id Product ID
* @param int $product_id Product ID.
* @param int $limit Limit of results.
* @param array $exclude_ids Exclude IDs from the results.
* @return array
@ -807,7 +807,7 @@ function wc_get_related_products( $product_id, $limit = 5, $exclude_ids = array(
$limit = $limit > 0 ? $limit : 5;
// We want to query related posts if they are not cached, or we don't have enough.
if ( false === $related_posts || sizeof( $related_posts ) < $limit ) {
if ( false === $related_posts || count( $related_posts ) < $limit ) {
// Related products are found from category and tags.
if ( apply_filters( 'woocommerce_product_related_posts_relate_by_category', true, $product_id ) ) {
$cats_array = wc_get_related_terms( $product_id, 'product_cat' );