Make WordPress Core


Ignore:
Timestamp:
09/19/2013 01:46:03 AM (13 years ago)
Author:
SergeyBiryukov
Message:

Introduce 'offset' parameter for wp_get_sites().

props jamescollins.
see #14511.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r25487 r25488  
    20082008 *     @type int       'deleted'    Retrieve deleted or non-deleted sites. Default null, for any.
    20092009 *     @type int       'limit'      Number of sites to limit the query to. Default 100.
     2010 *     @type int       'offset'     Exclude the first x sites. Used in combination with the limit parameter. Default 0.
    20102011 * }
    20112012 *
     
    20262027                'deleted'    => null,
    20272028                'limit'      => 100,
     2029                'offset'     => 0,
    20282030        );
    20292031
     
    20522054                $query .= $wpdb->prepare( "AND deleted = %d ", $args['deleted'] );
    20532055
    2054         if ( isset( $args['limit'] ) )
    2055                 $query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
     2056        if ( isset( $args['limit'] ) && $args['limit'] ) {
     2057                if ( isset( $args['offset'] ) && $args['offset'] )
     2058                        $query .= $wpdb->prepare( "LIMIT %d , %d ", $args['offset'], $args['limit'] );
     2059                else
     2060                        $query .= $wpdb->prepare( "LIMIT %d ", $args['limit'] );
     2061        }
    20562062
    20572063        $site_results = $wpdb->get_results( $query, ARRAY_A );
Note: See TracChangeset for help on using the changeset viewer.