On this page
WP_Terms_List_Table::__construct( array $args = array() )
Constructor.
Description
See also
- WP_List_Table::__construct(): for more information on default arguments.
Parameters
$argsarray Optional-
An associative array of arguments.
Default:
array()
Source
File: wp-admin/includes/class-wp-terms-list-table.php. View all references
public function __construct( $args = array() ) {
global $post_type, $taxonomy, $action, $tax;
parent::__construct(
array(
'plural' => 'tags',
'singular' => 'tag',
'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
)
);
$action = $this->screen->action;
$post_type = $this->screen->post_type;
$taxonomy = $this->screen->taxonomy;
if ( empty( $taxonomy ) ) {
$taxonomy = 'post_tag';
}
if ( ! taxonomy_exists( $taxonomy ) ) {
wp_die( __( 'Invalid taxonomy.' ) );
}
$tax = get_taxonomy( $taxonomy );
// @todo Still needed? Maybe just the show_ui part.
if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) {
$post_type = 'post';
}
}
Related
Uses
| Uses | Description |
|---|---|
| WP_List_Table::__construct() wp-admin/includes/class-wp-list-table.php | Constructor. |
| taxonomy_exists() wp-includes/taxonomy.php | Determines whether the taxonomy name exists. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| wp_die() wp-includes/functions.php | Kills WordPress execution and displays HTML page with an error message. |
| get_taxonomy() wp-includes/taxonomy.php | Retrieves the taxonomy object of $taxonomy. |
| get_post_types() wp-includes/post.php | Gets a list of all registered post type objects. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_terms_list_table/__construct