<option>

Filters the number of items to be displayed on each page of the list table.

Description

apply_filters( '<option>', (int) $per_page ); 

The dynamic hook name, $option, refers to the per_page option depending on the type of list table in use. Possible values include: edit_comments_per_page,, 'sites_network_per_page', site_themes_network_per_page, themes_network_per_page, 'users_network_per_page', edit_post_per_page, edit_page_per_page, 'edit__per_page', etc.

Parameters (1)

0. $per_page (int)
Number of items to be displayed. Default 20.

Usage

To run the hook, copy the example below.
  1. $per_page = apply_filters( '{$option}', $per_page ); 
  2.  
  3. if ( !empty( $per_page ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the <option> callback 
  2. function filter_option( $per_page ) { 
  3. // make filter magic happen here... 
  4. return $per_page
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "{$option}", 'filter_option', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "{$option}", 'filter_option', 10, 1 ); 

Defined (2)

The filter is defined in the following location(s).

/wp-admin/includes/class-wp-list-table.php  
  1. return (int) apply_filters( $option, $per_page ); 
/wp-admin/includes/class-wp-screen.php  
  1. $per_page = apply_filters( $option, $per_page );