wppaste
WordPress

WP_Themes_List_Table

Since
3.1.0
Source
wp-admin/includes/class-wp-themes-list-table.php:17
Core class used to implement displaying installed themes in a list table.

Compatibility

WordPress
since 3.1.0
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0).

Hooks and filters fired · 2

Every hook that fires from inside WP_Themes_List_Table, in the order it appears in the class, grouped by the method that fires it.

Properties · 2

$search_termsprotected
$featurespublic

Methods · 11

Source code

class WP_Themes_List_Table extends WP_List_Table { 	protected $search_terms = array();	public $features        = array(); 	/**	 * Constructor.	 *	 * @since 3.1.0	 *	 * @see WP_List_Table::__construct() for more information on default arguments.	 *	 * @param array $args An associative array of arguments.	 */	public function __construct( $args = array() ) {		parent::__construct(			array(				'ajax'   => true,				'screen' => $args['screen'] ?? null,			)		);	} 	/**	 * @return bool	 */	public function ajax_user_can() {		// Do not check edit_theme_options here. Ajax calls for available themes require switch_themes.		return current_user_can( 'switch_themes' );	} 	/**	 */	public function prepare_items() {		$themes = wp_get_themes( array( 'allowed' => true ) ); 		if ( ! empty( $_REQUEST['s'] ) ) {			$this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );		} 		if ( ! empty( $_REQUEST['features'] ) ) {			$this->features = $_REQUEST['features'];		} 		if ( $this->search_terms || $this->features ) {			foreach ( $themes as $key => $theme ) {				if ( ! $this->search_theme( $theme ) ) {					unset( $themes[ $key ] );				}			}		} 		unset( $themes[ get_option( 'stylesheet' ) ] );		WP_Theme::sort_by_name( $themes ); 		$per_page = 36;		$page     = $this->get_pagenum(); 		$start = ( $page - 1 ) * $per_page; 		$this->items = array_slice( $themes, $start, $per_page, true ); 		$this->set_pagination_args(			array(				'total_items'     => count( $themes ),				'per_page'        => $per_page,				'infinite_scroll' => true,			)		);	} 	/**	 */	public function no_items() {		if ( $this->search_terms || $this->features ) {			_e( 'No items found.' );			return;		} 		$blog_id = get_current_blog_id();

Changelog

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-admin/includes/class-wp-themes-list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.