Changeset 5730
- Timestamp:
- 05/12/2015 10:00:47 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/common/functions.php
r5718 r5730 1529 1529 $post_status = "'" . implode( "', '", $post_status ) . "'"; 1530 1530 1531 $child_id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", $parent_id, $post_type ) );1531 $child_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC LIMIT 1;", $parent_id, $post_type ) ); 1532 1532 wp_cache_set( $cache_id, $child_id, 'bbpress_posts' ); 1533 1533 } 1534 1534 1535 1535 // Filter and return 1536 return apply_filters( 'bbp_get_public_child_last_id', (int)$child_id, $parent_id, $post_type );1536 return (int) apply_filters( 'bbp_get_public_child_last_id', $child_id, $parent_id, $post_type ); 1537 1537 } 1538 1538 … … 1577 1577 $post_status = "'" . implode( "', '", $post_status ) . "'"; 1578 1578 1579 $child_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $parent_id, $post_type ) );1579 $child_count = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(ID) FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s';", $parent_id, $post_type ) ); 1580 1580 wp_cache_set( $cache_id, $child_count, 'bbpress_posts' ); 1581 1581 } 1582 1582 1583 1583 // Filter and return 1584 return apply_filters( 'bbp_get_public_child_count', (int)$child_count, $parent_id, $post_type );1584 return (int) apply_filters( 'bbp_get_public_child_count', $child_count, $parent_id, $post_type ); 1585 1585 } 1586 1586 … … 1625 1625 $post_status = "'" . implode( "', '", $post_status ) . "'"; 1626 1626 1627 $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) );1627 $child_ids = (array) $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) ); 1628 1628 wp_cache_set( $cache_id, $child_ids, 'bbpress_posts' ); 1629 1629 } 1630 1630 1631 1631 // Filter and return 1632 return apply_filters( 'bbp_get_public_child_ids', $child_ids, $parent_id, $post_type );1632 return (array) apply_filters( 'bbp_get_public_child_ids', $child_ids, $parent_id, $post_type ); 1633 1633 } 1634 1634 … … 1689 1689 $post_status = "'" . implode( "', '", $post_status ) . "'"; 1690 1690 1691 $child_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) );1691 $child_ids = (array) $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent = %d AND post_status IN ( {$post_status} ) AND post_type = '%s' ORDER BY ID DESC;", $parent_id, $post_type ) ); 1692 1692 wp_cache_set( $cache_id, $child_ids, 'bbpress_posts' ); 1693 1693 } 1694 1694 1695 1695 // Filter and return 1696 return apply_filters( 'bbp_get_all_child_ids', $child_ids, (int)$parent_id, $post_type );1696 return (array) apply_filters( 'bbp_get_all_child_ids', $child_ids, $parent_id, $post_type ); 1697 1697 } 1698 1698
Note: See TracChangeset
for help on using the changeset viewer.