WP_Plugins_List_Table::__construct() WordPress Method

The WP_Plugins_List_Table::__construct() function is used to initialize the list table for displaying plugins. It takes two parameters: an array of plugins and an array of columns. The plugins array is used to populate the list table, while the columns array is used to define the columns that will be displayed in the table.

WP_Plugins_List_Table::__construct( array $args = array() ) #

Constructor.


Description

Top ↑

See also


Top ↑

Parameters

$args

(array)(Optional)An associative array of arguments.

Default value: array()


Top ↑

Source

File: wp-admin/includes/class-wp-plugins-list-table.php

	public function __construct( $args = array() ) {
		global $status, $page;

		parent::__construct(
			array(
				'plural' => 'plugins',
				'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
			)
		);

		$allowed_statuses = array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search', 'paused', 'auto-update-enabled', 'auto-update-disabled' );

		$status = 'all';
		if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], $allowed_statuses, true ) ) {
			$status = $_REQUEST['plugin_status'];
		}

		if ( isset( $_REQUEST['s'] ) ) {
			$_SERVER['REQUEST_URI'] = add_query_arg( 's', wp_unslash( $_REQUEST['s'] ) );
		}

		$page = $this->get_pagenum();

		$this->show_autoupdates = wp_is_auto_update_enabled_for_type( 'plugin' )
			&& current_user_can( 'update_plugins' )
			&& ( ! is_multisite() || $this->screen->in_admin( 'network' ) )
			&& ! in_array( $status, array( 'mustuse', 'dropins' ), true );
	}


Top ↑

Changelog

Changelog
VersionDescription
3.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.