Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: upload_per_page

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
131
132 if ( ! isset( $_GET['paged'] ) || $_GET['paged'] < 1 )
133      $_GET['paged'] = 1;
134
135 if ( isset($_GET['detached']) ) {
136
137      $media_per_page = (int) get_user_option( 'upload_per_page', 0, false );
138      if ( empty($media_per_page) || $media_per_page < 1 )
139           $media_per_page = 20;
140      $media_per_page = apply_filters( 'upload_per_page', $media_per_page );
141
142      if ( !empty($lost) ) {
143           $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page;
144           $page_links_total = ceil(count($lost) / $media_per_page);
145           $lost = implode(',', $lost);
146
147           $orphans = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_type = 'attachment' AND ID IN (%s) LIMIT %d, %d", $lost, $start, $media_per_page ) );
148      } else {
149           $start = ( (int) $_GET['paged'] - 1 ) * $media_per_page;