Source View: {$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.

  • Action hooks look like this: do_action( "hook_name" )
  • Filter hooks look like this: apply_filters( "hook_name", "what_to_filter" ).

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
919           $order = $q['order'];
920      elseif ( isset($q['post_status']) && 'pending' == $q['post_status'] )
921           $order = 'ASC';
922
923      $per_page = 'edit_' . $post_type . '_per_page';
924      $posts_per_page = (int) get_user_option( $per_page );
925      if ( empty( $posts_per_page ) || $posts_per_page < 1 )
926           $posts_per_page = 20;
927
928      $posts_per_page = apply_filters( $per_page, $posts_per_page );
929      $posts_per_page = apply_filters( 'edit_posts_per_page', $posts_per_page, $post_type );
930
931      $query = compact('post_type', 'post_status', 'perm', 'order', 'orderby', 'posts_per_page');
932
933      // Hierarchical types require special args.
934      if ( is_post_type_hierarchical( $post_type ) && !isset($orderby) ) {
935           $query['orderby'] = 'menu_order title';
936           $query['order'] = 'asc';
937           $query['posts_per_page'] = -1;