Title: WP_List_Table::__construct
Published: April 25, 2014
Last modified: April 28, 2025

---

# WP_List_Table::__construct( array|string $args = array() )

## In this article

 * [Description](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#description)
 * [Parameters](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#parameters)
 * [More Information](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#more-information)
 * [Source](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#wp--skip-link--target)

Constructor.

## 󠀁[Description](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#description)󠁿

The child class should call this constructor from its own constructor to override
the default $args.

## 󠀁[Parameters](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#parameters)󠁿

 `$args`array|stringoptional

Array or string of arguments.

 * `plural` string
 * Plural value used for labels and the objects being listed.
    This affects things
   such as CSS class-names and nonces used in the list table, e.g. `'posts'`.
 * `singular` string
 * Singular label for an object being listed, e.g. `'post'`.
    Default empty
 * `ajax` bool
 * Whether the list table supports Ajax. This includes loading and sorting data,
   for example. If true, the class will call the _js_vars() method in the footer
   to provide variables to any scripts handling Ajax events. Default false.
 * `screen` string
 * String containing the hook name used to determine the current screen. If left
   null, the current screen will be automatically set.
    Default null.

Default:`array()`

## 󠀁[More Information](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#more-information)󠁿

This sets default arguments and filters. Developers should override this, calling
the parent constructor to provide values for singular and plural labels, as well
as whether the class supports AJAX.

## 󠀁[Source](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#source)󠁿

    ```php
    public function __construct( $args = array() ) {
    	$args = wp_parse_args(
    		$args,
    		array(
    			'plural'   => '',
    			'singular' => '',
    			'ajax'     => false,
    			'screen'   => null,
    		)
    	);

    	$this->screen = convert_to_screen( $args['screen'] );

    	add_filter( "manage_{$this->screen->id}_columns", array( $this, 'get_columns' ), 0 );

    	if ( ! $args['plural'] ) {
    		$args['plural'] = $this->screen->base;
    	}

    	$args['plural']   = sanitize_key( $args['plural'] );
    	$args['singular'] = sanitize_key( $args['singular'] );

    	$this->_args = $args;

    	if ( $args['ajax'] ) {
    		// wp_enqueue_script( 'list-table' );
    		add_action( 'admin_footer', array( $this, '_js_vars' ) );
    	}

    	if ( empty( $this->modes ) ) {
    		$this->modes = array(
    			'list'    => __( 'Compact view' ),
    			'excerpt' => __( 'Extended view' ),
    		);
    	}
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/class-wp-list-table.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/class-wp-list-table.php#L138)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/class-wp-list-table.php#L138-L173)

## 󠀁[Related](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#related)󠁿

| Uses | Description | 
| [convert_to_screen()](https://developer.wordpress.org/reference/functions/convert_to_screen/)`wp-admin/includes/template.php` |

Converts a screen string to a screen object.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [sanitize_key()](https://developer.wordpress.org/reference/functions/sanitize_key/)`wp-includes/formatting.php` |

Sanitizes a string key.

  | 
| [wp_parse_args()](https://developer.wordpress.org/reference/functions/wp_parse_args/)`wp-includes/functions.php` |

Merges user defined arguments into defaults array.

  | 
| [add_filter()](https://developer.wordpress.org/reference/functions/add_filter/)`wp-includes/plugin.php` |

Adds a callback function to a filter hook.

  | 
| [add_action()](https://developer.wordpress.org/reference/functions/add_action/)`wp-includes/plugin.php` |

Adds a callback function to an action hook.

  |

[Show 4 more](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#)

| Used by | Description | 
| [WP_Plugins_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_plugins_list_table/__construct/)`wp-admin/includes/class-wp-plugins-list-table.php` |

Constructor.

  | 
| [WP_Links_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_links_list_table/__construct/)`wp-admin/includes/class-wp-links-list-table.php` |

Constructor.

  | 
| [WP_MS_Themes_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_ms_themes_list_table/__construct/)`wp-admin/includes/class-wp-ms-themes-list-table.php` |

Constructor.

  | 
| [WP_Themes_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_themes_list_table/__construct/)`wp-admin/includes/class-wp-themes-list-table.php` |

Constructor.

  | 
| [WP_MS_Sites_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_ms_sites_list_table/__construct/)`wp-admin/includes/class-wp-ms-sites-list-table.php` |

Constructor.

  | 
| [WP_Users_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_users_list_table/__construct/)`wp-admin/includes/class-wp-users-list-table.php` |

Constructor.

  | 
| [WP_Media_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_media_list_table/__construct/)`wp-admin/includes/class-wp-media-list-table.php` |

Constructor.

  | 
| [WP_Comments_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_comments_list_table/__construct/)`wp-admin/includes/class-wp-comments-list-table.php` |

Constructor.

  | 
| [WP_Terms_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_terms_list_table/__construct/)`wp-admin/includes/class-wp-terms-list-table.php` |

Constructor.

  | 
| [WP_Posts_List_Table::__construct()](https://developer.wordpress.org/reference/classes/wp_posts_list_table/__construct/)`wp-admin/includes/class-wp-posts-list-table.php` |

Constructor.

  |

[Show 5 more](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/classes/WP_List_Table/__construct/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.1.0](https://developer.wordpress.org/reference/since/3.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fclasses%2Fwp_list_table%2F__construct%2F)
before being able to contribute a note or feedback.